<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Asciidoctor 1.5.7.1">
<title>Flowable Form 用户手册 (v 6.4.2-SNAPSHOT)</title>
<style>

/* normalize.css */

button,hr,input{overflow:visible}audio,canvas,progress,video{display:inline-block}progress,sub,sup{vertical-align:baseline}html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0} menu,article,aside,details,footer,header,nav,section{display:block}h1{font-size:2em;margin:.67em 0}figcaption,figure,main{display:block}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}dfn{font-style:italic}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}button,input{}button,select{text-transform:none}[type=submit], [type=reset],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:ButtonText dotted 1px}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}[hidden],template{display:none}/*# sourceMappingURL=normalize.min.css.map */

/* tocbot 2.1.4 */

.toc{overflow-y:auto}.toc>ul{overflow:hidden;position:relative}.toc-list{margin:0;padding-left:10px}a.toc-link{color:currentColor;height:100%}.is-collapsible{max-height:1000px;overflow:hidden;transition:all 300ms ease-in-out}.is-collapsed{max-height:0}.is-position-fixed{position:fixed !important;top:0}.is-active-link{font-weight:700}.toc-link::before{background-color:#f9f9fb;content:' ';display:inline-block;height:inherit;left:8px;margin-top:-1px;position:absolute;width:2px}.is-active-link::before{background-color:#54BC4B}


/* Activiti Specific */

body {
  color: #494d55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  height: 100%;
  width: 100%;
  background: #f9f9f9;
  font-family: "Helvetica Neue",Helvetica,Roboto,Arial,sans-serif;
  color: #484848
}

.page-wrapper {
  min-height: 100%;
  /* equal to footer height */
  margin-bottom: -50px;
}

.page-wrapper:after {
  content: "";
  display: block;
  height: 50px;
}

#header {
  position:fixed;
  top:0px;
  z-index:100000;
  width:100%;
}

#header > h1 {
    background: #a0cc47;
    color: #f9f9f9;
    border-bottom: 2px solid #042944;
    padding: 20px 0 20px 20px;
    font-size: 40px;
    font-weight: 800;
    line-height: 1.1;
    margin: 0;
}

#header > h1:before {
  background:url('images/logo.png');
  background-size: 337px 54px; background-repeat: no-repeat;
  width: 337px;
  height: 54px;
  display:inline-block;
  content:'';
  margin-right: 30px;
}

#author {
  margin-left: 25%;
  font-size: 40px;
}

#content {
  margin: 129px 0 0 27%;
  padding: 10px 40px 0 20px;
  padding-right: 40px;
  line-height: 1.7;
  width: 65%;
  overflow-x: auto;
}

h2, h3, h4, h5, h6 {
  color: #00345a;
}

h2 {
  font-size: 26px;
  margin-top: 0;
  margin-bottom: 20px;
  font-weight: bold;
  padding-bottom: 10px;
  border-bottom: 1px solid #d7d7d7;
}

h3 {
  font-size: 18px;
  margin-top: 0;
  margin-bottom: 0;
  font-weight: bold;
  padding-bottom: 10px;
  /*border-bottom: 1px solid #d7d7d7;*/
}

h4 {
    font-size: 16px;
    font-weight: bold;
}

h5 {
    font-size: 14px;
    font-weight: bold;
}

h6, h7 {
    font-size: 14px;
    font-weight: bold;
    margin-top: 0;
    margin-bottom: 0;
}

.sect1, .sect2 {
  margin-bottom: 20px;
}

.clear
{
  clear: both;
}

.note, .listingblock, .literalblock{
  padding-left: 8px;
  padding-right: 8px;
  margin-bottom: 14px;
  background-color: #f7f7f9;
  border: 1px solid #e1e1e8;
  border-radius: 4px;
  color: #808080;
}

table.tableblock {
  width: 100%;
  max-width: 100%;
  margin-bottom: 20px;
  background-color: transparent;
  border-spacing: 0;
  border-collapse: collapse;
  border: 1px solid #ddd;
  table-layout: fixed;
}

table.tableblock>caption+thead>tr:first-child>td, table.tableblock>caption+thead>tr:first-child>th, table.tableblock>colgroup+thead>tr:first-child>td, table.tableblock>colgroup+thead>tr:first-child>th, table.tableblock>thead:first-child>tr:first-child>td, table.tableblock>thead:first-child>tr:first-child>th {
    border-top: 0;
}

table.tableblock > thead > tr > th {
    border-bottom-color: #8bd6d8;
}

table.tableblock>thead>tr>th {
    vertical-align: bottom;
    border-bottom: 1px solid #ddd;
}

table.tableblock>tbody>tr>td, table.tableblock>tbody>tr>th, table.tableblock>tfoot>tr>td, table.tableblock>tfoot>tr>th, table.tableblock>thead>tr>td, table.tableblock>thead>tr>th {
    padding: 8px;
    line-height: 1.42857143;
    vertical-align: top;
    border-top: 1px solid #ddd;
}

th {
    text-align: left;
}

table.tableblock > tbody > tr:nth-of-type(odd) {
    background-color: #f5f5f5;
}

table.tableblock > tbody > tr:nth-of-type(odd) {
    background-color: #f9f9f9;
}

td > p {
  margin:0;
}

td.content {
  white-space: normal;
}

pre, td, th {
   white-space: pre-wrap;
   white-space: -moz-pre-wrap;
   white-space: -pre-wrap;
   white-space: -o-pre-wrap;
   word-wrap: break-word;
}

img {
  max-width: 100%;
}

a {
  color: #007387;
}

a:hover {
  color: #004c59;
}

#toc-parent {
  width: 25%;
  float: left;
  height: 100%;
  overflow-y: auto;
  position: fixed;
  padding: 10px;
  border-right: 1px solid #ccc;
}

#generated-toc {
    width: 100%;
    height: 100%;
    font-size: 16px;
}

.toc-link {
  text-decoration: none;
}

.toc-list {
  margin: 0 20px 0 10px;
}

.toc-list-item {
  padding: 4px 0 4px 0;
}


div.sect5  p {
    margin-top: 0;
    margin-bottom: 0;
}

div.sect5  code {
    font-family: "Helvetica Neue",Helvetica,Roboto,Arial,sans-serif;
}
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
.listingblock .pygments .hll { background-color: #ffffcc }
.listingblock .pygments, .listingblock .pygments code { background: #f8f8f8; }
.listingblock .pygments .tok-c { color: #408080; font-style: italic } /* Comment */
.listingblock .pygments .tok-err { border: 1px solid #FF0000 } /* Error */
.listingblock .pygments .tok-k { color: #008000; font-weight: bold } /* Keyword */
.listingblock .pygments .tok-o { color: #666666 } /* Operator */
.listingblock .pygments .tok-ch { color: #408080; font-style: italic } /* Comment.Hashbang */
.listingblock .pygments .tok-cm { color: #408080; font-style: italic } /* Comment.Multiline */
.listingblock .pygments .tok-cp { color: #BC7A00 } /* Comment.Preproc */
.listingblock .pygments .tok-cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */
.listingblock .pygments .tok-c1 { color: #408080; font-style: italic } /* Comment.Single */
.listingblock .pygments .tok-cs { color: #408080; font-style: italic } /* Comment.Special */
.listingblock .pygments .tok-gd { color: #A00000 } /* Generic.Deleted */
.listingblock .pygments .tok-ge { font-style: italic } /* Generic.Emph */
.listingblock .pygments .tok-gr { color: #FF0000 } /* Generic.Error */
.listingblock .pygments .tok-gh { color: #000080; font-weight: bold } /* Generic.Heading */
.listingblock .pygments .tok-gi { color: #00A000 } /* Generic.Inserted */
.listingblock .pygments .tok-go { color: #888888 } /* Generic.Output */
.listingblock .pygments .tok-gp { color: #000080; font-weight: bold } /* Generic.Prompt */
.listingblock .pygments .tok-gs { font-weight: bold } /* Generic.Strong */
.listingblock .pygments .tok-gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.listingblock .pygments .tok-gt { color: #0044DD } /* Generic.Traceback */
.listingblock .pygments .tok-kc { color: #008000; font-weight: bold } /* Keyword.Constant */
.listingblock .pygments .tok-kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
.listingblock .pygments .tok-kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
.listingblock .pygments .tok-kp { color: #008000 } /* Keyword.Pseudo */
.listingblock .pygments .tok-kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
.listingblock .pygments .tok-kt { color: #B00040 } /* Keyword.Type */
.listingblock .pygments .tok-m { color: #666666 } /* Literal.Number */
.listingblock .pygments .tok-s { color: #BA2121 } /* Literal.String */
.listingblock .pygments .tok-na { color: #7D9029 } /* Name.Attribute */
.listingblock .pygments .tok-nb { color: #008000 } /* Name.Builtin */
.listingblock .pygments .tok-nc { color: #0000FF; font-weight: bold } /* Name.Class */
.listingblock .pygments .tok-no { color: #880000 } /* Name.Constant */
.listingblock .pygments .tok-nd { color: #AA22FF } /* Name.Decorator */
.listingblock .pygments .tok-ni { color: #999999; font-weight: bold } /* Name.Entity */
.listingblock .pygments .tok-ne { color: #D2413A; font-weight: bold } /* Name.Exception */
.listingblock .pygments .tok-nf { color: #0000FF } /* Name.Function */
.listingblock .pygments .tok-nl { color: #A0A000 } /* Name.Label */
.listingblock .pygments .tok-nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
.listingblock .pygments .tok-nt { color: #008000; font-weight: bold } /* Name.Tag */
.listingblock .pygments .tok-nv { color: #19177C } /* Name.Variable */
.listingblock .pygments .tok-ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
.listingblock .pygments .tok-w { color: #bbbbbb } /* Text.Whitespace */
.listingblock .pygments .tok-mb { color: #666666 } /* Literal.Number.Bin */
.listingblock .pygments .tok-mf { color: #666666 } /* Literal.Number.Float */
.listingblock .pygments .tok-mh { color: #666666 } /* Literal.Number.Hex */
.listingblock .pygments .tok-mi { color: #666666 } /* Literal.Number.Integer */
.listingblock .pygments .tok-mo { color: #666666 } /* Literal.Number.Oct */
.listingblock .pygments .tok-sa { color: #BA2121 } /* Literal.String.Affix */
.listingblock .pygments .tok-sb { color: #BA2121 } /* Literal.String.Backtick */
.listingblock .pygments .tok-sc { color: #BA2121 } /* Literal.String.Char */
.listingblock .pygments .tok-dl { color: #BA2121 } /* Literal.String.Delimiter */
.listingblock .pygments .tok-sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
.listingblock .pygments .tok-s2 { color: #BA2121 } /* Literal.String.Double */
.listingblock .pygments .tok-se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
.listingblock .pygments .tok-sh { color: #BA2121 } /* Literal.String.Heredoc */
.listingblock .pygments .tok-si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
.listingblock .pygments .tok-sx { color: #008000 } /* Literal.String.Other */
.listingblock .pygments .tok-sr { color: #BB6688 } /* Literal.String.Regex */
.listingblock .pygments .tok-s1 { color: #BA2121 } /* Literal.String.Single */
.listingblock .pygments .tok-ss { color: #19177C } /* Literal.String.Symbol */
.listingblock .pygments .tok-bp { color: #008000 } /* Name.Builtin.Pseudo */
.listingblock .pygments .tok-fm { color: #0000FF } /* Name.Function.Magic */
.listingblock .pygments .tok-vc { color: #19177C } /* Name.Variable.Class */
.listingblock .pygments .tok-vg { color: #19177C } /* Name.Variable.Global */
.listingblock .pygments .tok-vi { color: #19177C } /* Name.Variable.Instance */
.listingblock .pygments .tok-vm { color: #19177C } /* Name.Variable.Magic */
.listingblock .pygments .tok-il { color: #666666 } /* Literal.Number.Integer.Long */
</style>
<script type="text/javascript">

/*
 * Tocbot.min.js version 2.1.4
 */

 !function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([/*!*************************!*\
   !*** ./src/js/index.js ***!
   \*************************/
 function(e,t,n){var o,i,r;(function(l){!function(n,l){i=[],o=l(n),r="function"==typeof o?o.apply(t,i):o,!(void 0!==r&&(e.exports=r))}("undefined"!=typeof l?l:this.window||this.global,function(e){"use strict";function t(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var o in n)h.call(n,o)&&(e[o]=n[o])}return e}function o(e,t,n){t||(t=250);var o,i;return function(){var r=n||this,l=+new Date,s=arguments;o&&l<o+t?(clearTimeout(i),i=setTimeout(function(){o=l,e.apply(r,s)},t)):(o=l,e.apply(r,s))}}var i,r,l,s=n(/*! smooth-scroll */1),c=n(/*! ./default-options.js */2),a={},u={},d=n(/*! ./build-html.js */3),f=n(/*! ./parse-content.js */4),m=(e.document,document.body,!!e.document.querySelector&&!!e.addEventListener),h=Object.prototype.hasOwnProperty;return u.destroy=function(){try{document.querySelector(a.tocSelector).innerHTML=""}catch(e){console.warn("Element not found: "+a.tocSelector)}document.removeEventListener("scroll",this._scrollListener,!1),document.removeEventListener("resize",this._scrollListener,!1),i&&document.removeEventListener("click",this._clickListener,!1),s&&s.destroy()},u.init=function(e){if(m&&(a=t(c,e||{}),this.options=a,this.state={},i=d(a),r=f(a),this._buildHtml=i,this._parseContent=r,u.destroy(),l=r.selectHeadings(a.contentSelector,a.headingSelector),null!==l)){var n=r.nestHeadingsArray(l),h=n.nest;return i.render(a.tocSelector,h),this._scrollListener=o(function(){i.updateToc(l)},a.throttleTimeout),this._scrollListener(),document.addEventListener("scroll",this._scrollListener,!1),document.addEventListener("resize",this._scrollListener,!1),this._clickListener=o(function(e){i.disableTocAnimation(e),i.updateToc(l)},a.throttleTimeout),document.addEventListener("click",this._clickListener,!1),s&&(this.smoothScroll=s.init(t(a.smoothScrollOptions,{callback:i.enableTocAnimation}))),this}},u.refresh=function(e){u.destroy(),u.init(e||this.options)},e.tocbot=u,u})}).call(t,function(){return this}())},/*!******************************************************!*\
   !*** ./~/smooth-scroll/dist/js/smooth-scroll.min.js ***!
   \******************************************************/
 function(e,t,n){var o,i,r;(function(n){/*! smooth-scroll v10.0.1 | (c) 2016 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */
 !function(n,l){i=[],o=l(n),r="function"==typeof o?o.apply(t,i):o,!(void 0!==r&&(e.exports=r))}("undefined"!=typeof n?n:this.window||this.global,function(e){"use strict";var t,n,o,i,r,l,s,c={},a="querySelector"in document&&"addEventListener"in e,u={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},d=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var i=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&"[object Object]"===Object.prototype.toString.call(n[o])?e[o]=d(!0,e[o],n[o]):e[o]=n[o])};o>n;n++){var r=arguments[n];i(r)}return e},f=function(e){return Math.max(e.scrollHeight,e.offsetHeight,e.clientHeight)},m=function(e,t){var n,o,i=t.charAt(0),r="classList"in document.documentElement;for("["===i&&(t=t.substr(1,t.length-2),n=t.split("="),n.length>1&&(o=!0,n[1]=n[1].replace(/"/g,"").replace(/'/g,"")));e&&e!==document&&1===e.nodeType;e=e.parentNode){if("."===i)if(r){if(e.classList.contains(t.substr(1)))return e}else if(new RegExp("(^|\\s)"+t.substr(1)+"(\\s|$)").test(e.className))return e;if("#"===i&&e.id===t.substr(1))return e;if("["===i&&e.hasAttribute(n[0])){if(!o)return e;if(e.getAttribute(n[0])===n[1])return e}if(e.tagName.toLowerCase()===t)return e}return null},h=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,i=-1,r="",l=n.charCodeAt(0);++i<o;){if(t=n.charCodeAt(i),0===t)throw new InvalidCharacterError("Invalid character: the input contains U+0000.");r+=t>=1&&31>=t||127==t||0===i&&t>=48&&57>=t||1===i&&t>=48&&57>=t&&45===l?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&57>=t||t>=65&&90>=t||t>=97&&122>=t?n.charAt(i):"\\"+n.charAt(i)}return"#"+r},p=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=.5>t?2*t*t:-1+(4-2*t)*t),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=.5>t?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=.5>t?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=.5>t?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},v=function(e,t,n){var o=0;if(e.offsetParent)do o+=e.offsetTop,e=e.offsetParent;while(e);return o=Math.max(o-t-n,0),Math.min(o,b()-g())},g=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},b=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},C=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},S=function(e){return e?f(e)+e.offsetTop:0},y=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};c.animateScroll=function(n,o,l){var c=C(o?o.getAttribute("data-options"):null),a=d(t||u,l||{},c),f="[object Number]"===Object.prototype.toString.call(n),m=f||!n.tagName?null:n;if(f||m){var h=e.pageYOffset;a.selectorHeader&&!i&&(i=document.querySelector(a.selectorHeader)),r||(r=S(i));var g,x,N=f?n:v(m,r,parseInt(a.offset,10)),L=N-h,O=b(),E=0,A=function(t,i,r){var l=e.pageYOffset;(t==i||l==i||e.innerHeight+l>=O)&&(clearInterval(r),y(n,i,f),a.callback(n,o))},H=function(){E+=16,g=E/parseInt(a.speed,10),g=g>1?1:g,x=h+L*p(a.easing,g),e.scrollTo(0,Math.floor(x)),A(x,N,s)},T=function(){clearInterval(s),s=setInterval(H,16)};0===e.pageYOffset&&e.scrollTo(0,0),T()}};var x=function(t){e.location.hash,n&&(n.id=n.getAttribute("data-scroll-id"),c.animateScroll(n,o),n=null,o=null)},N=function(i){if(0===i.button&&!i.metaKey&&!i.ctrlKey&&(o=m(i.target,t.selector),o&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href))){var r=h(o.hash);if("#"===r){i.preventDefault(),n=document.body;var l=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",l),n.id="",void(e.location.hash.substring(1)===l?x():e.location.hash=l)}n=document.querySelector(r),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(i.preventDefault(),x()))}},L=function(e){l||(l=setTimeout(function(){l=null,r=S(i)},66))};return c.destroy=function(){t&&(document.removeEventListener("click",N,!1),e.removeEventListener("resize",L,!1),t=null,n=null,o=null,i=null,r=null,l=null,s=null)},c.init=function(n){a&&(c.destroy(),t=d(u,n||{}),i=t.selectorHeader?document.querySelector(t.selectorHeader):null,r=S(i),document.addEventListener("click",N,!1),e.addEventListener("hashchange",x,!1),i&&e.addEventListener("resize",L,!1))},c})}).call(t,function(){return this}())},/*!***********************************!*\
   !*** ./src/js/default-options.js ***!
   \***********************************/
 function(e,t){e.exports={tocSelector:".js-toc",contentSelector:".js-toc-content",headingSelector:"h1, h2, h3",ignoreSelector:".js-toc-ignore",linkClass:"toc-link",extraLinkClasses:"",activeLinkClass:"is-active-link",listClass:"toc-list",extraListClasses:"",isCollapsedClass:"is-collapsed",collapsibleClass:"is-collapsible",listItemClass:"toc-list-item",collapseDepth:0,smoothScrollOptions:{easing:"easeInOutCubic",offset:0,speed:300,updateURL:!0},headingsOffset:0,throttleTimeout:50,positionFixedSelector:null,positionFixedClass:"is-position-fixed",fixedSidebarOffset:"auto",includeHtml:!1}},/*!******************************!*\
   !*** ./src/js/build-html.js ***!
   \******************************/
 function(e,t){e.exports=function(e){function t(e,n){var r=n.appendChild(o(e));if(e.children.length){var l=i(e.isCollapsed);e.children.forEach(function(e){t(e,l)}),r.appendChild(l)}}function n(e,n){var o=!1,r=i(o);n.forEach(function(e){t(e,r)});var l=document.querySelector(e);if(null!==l)return l.firstChild&&l.removeChild(l.firstChild),l.appendChild(r)}function o(t){var n=document.createElement("li"),o=document.createElement("a");return e.listItemClass&&n.setAttribute("class",e.listItemClass),e.includeHtml&&t.childNodes.length?u.call(t.childNodes,function(e){o.appendChild(e.cloneNode(!0))}):o.textContent=t.textContent,o.setAttribute("data-scroll",""),o.setAttribute("href","#"+t.id),o.setAttribute("class",e.linkClass+h+"node-name--"+t.nodeName+h+e.extraLinkClasses),n.appendChild(o),n}function i(t){var n=document.createElement("ul"),o=e.listClass+h+e.extraListClasses;return t&&(o+=h+e.collapsibleClass,o+=h+e.isCollapsedClass),n.setAttribute("class",o),n}function r(){var t=document.documentElement.scrollTop||f.scrollTop,n=document.querySelector(e.positionFixedSelector);"auto"===e.fixedSidebarOffset&&(e.fixedSidebarOffset=document.querySelector(e.tocSelector).offsetTop),t>e.fixedSidebarOffset?n.className.indexOf(e.positionFixedClass)===-1&&(n.className+=h+e.positionFixedClass):n.className=n.className.split(h+e.positionFixedClass).join("")}function l(t){var n=document.documentElement.scrollTop||f.scrollTop;e.positionFixedSelector&&r();var o,i=t;if(m&&null!==document.querySelector(e.tocSelector)&&i.length>0){d.call(i,function(t,r){if(t.offsetTop>n+e.headingsOffset){var l=0===r?r:r-1;return o=i[l],!0}if(r===i.length-1)return o=i[i.length-1],!0});var l=document.querySelector(e.tocSelector).querySelectorAll("."+e.linkClass);u.call(l,function(t){t.className=t.className.split(h+e.activeLinkClass).join("")});var c=document.querySelector(e.tocSelector).querySelector("."+e.linkClass+".node-name--"+o.nodeName+'[href="#'+o.id+'"]');c.className+=h+e.activeLinkClass;var a=document.querySelector(e.tocSelector).querySelectorAll("."+e.listClass+"."+e.collapsibleClass);u.call(a,function(t){var n=h+e.isCollapsedClass;t.className.indexOf(n)===-1&&(t.className+=h+e.isCollapsedClass)}),c.nextSibling&&(c.nextSibling.className=c.nextSibling.className.split(h+e.isCollapsedClass).join("")),s(c.parentNode.parentNode)}}function s(t){return t.className.indexOf(e.collapsibleClass)!==-1?(t.className=t.className.split(h+e.isCollapsedClass).join(""),s(t.parentNode.parentNode)):t}function c(t){var n=t.target||t.srcElement;n.className.indexOf(e.linkClass)!==-1&&(m=!1)}function a(){m=!0}var u=[].forEach,d=[].some,f=document.body,m=!0,h=" ";return{enableTocAnimation:a,disableTocAnimation:c,render:n,updateToc:l}}},/*!*********************************!*\
   !*** ./src/js/parse-content.js ***!
   \*********************************/
 function(e,t){e.exports=function(e){function t(e){return e[e.length-1]}function n(e){return+e.nodeName.split("H").join("")}function o(t){var o={id:t.id,children:[],nodeName:t.nodeName,headingLevel:n(t),textContent:t.textContent.trim()};return e.includeHtml&&(o.childNodes=t.childNodes),o}function i(i,r){for(var l=o(i),s=n(i),c=r,a=t(c),u=a?a.headingLevel:0,d=s-u;d>0;)a=t(c),a&&void 0!==a.children&&(c=a.children),d--;return s>=e.collapseDepth&&(l.isCollapsed=!0),c.push(l),c}function r(t,n){var o=n;e.ignoreSelector&&(o=n.split(",").map(function(t){return t.trim()+":not("+e.ignoreSelector+")"}));try{return document.querySelector(t).querySelectorAll(o)}catch(i){return console.warn("Element not found: "+t),null}}function l(e){return s.call(e,function(e,t){var n=o(t);return i(n,e.nest),e},{nest:[]})}var s=[].reduce;return{nestHeadingsArray:l,selectHeadings:r}}}]);
 //# sourceMappingURL=tocbot.min.js.map

</script>

<script type="text/javascript">

  var generateToc = function() {
    var readyState = document.readyState;
    if (readyState === 'interactive' || readyState == 'complete') {

      var headerSize = 140;

      var tocParentNode = document.createElement("div");
      tocParentNode.setAttribute("id", "toc-parent");

      var generatedTocNode = document.createElement("div");
      generatedTocNode.setAttribute("id", "generated-toc");
      tocParentNode.appendChild(generatedTocNode);

      var contentNode = document.getElementById("content");
      contentNode.parentNode.insertBefore(tocParentNode, contentNode);

      var clearNode = document.createElement("div");
      clearNode.setAttribute("class", "clear");
      contentNode.parentNode.appendChild(clearNode);

      tocbot.init({
        tocSelector: '#generated-toc',
        contentSelector: '#content',
        headingSelector: 'h2, h3, h4, h5',
        headingsOffset: headerSize,
        smoothScrollOptions: {
          easing: 'easeInOutCubic',
          offset: headerSize,
          speed: 300, // animation duration.
          updateURL: true
        },
        collapseDepth: 0
      });

    } else {
      window.setTimeout(function(){
        generateToc();
      }, 50);
    }

  }
  generateToc();

</script>
</head>
<body class="book">
<div id="header">
<h1>Flowable Form 用户手册 (v 6.4.2-SNAPSHOT)</h1>
</div>
<div id="content">
<div class="sect1">
<h2 id="_introduction">1. Introduction</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="license">1.1. 翻译(说明)</h3>
<div class="paragraph">
<p>由[分享牛Flowable中国社区] 翻译，任何意见建议,欢迎联系QQ:3152981878。
如果想一起成为开源代码贡献人员，欢迎大家加入qq交流群为社区贡献添砖加瓦。qq贡献群：1023773998</p>
</div>
</div>
<div class="sect2">
<h3 id="_协议">1.2. 协议</h3>
<div class="paragraph">
<p>Flowable在<a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache V2 协议</a>下发布。</p>
</div>
</div>
<div class="sect2">
<h3 id="download">1.3. 下载</h3>
<div class="paragraph">
<p><a href="http://www.flowable.org/downloads.html"><a href="http://www.flowable.org/downloads.html" class="bare">http://www.flowable.org/downloads.html</a></a></p>
</div>
</div>
<div class="sect2">
<h3 id="sources">1.4. 源码</h3>
<div class="paragraph">
<p>Flowable的发布包里包含了大部分源码，以JAR文件方式提供。Flowable的源码也可以通过以下链接获得：
  <a href="https://github.com/flowable/flowable-engine"><a href="https://github.com/flowable/flowable-engine" class="bare">https://github.com/flowable/flowable-engine</a></a></p>
</div>
</div>
<div class="sect2">
<h3 id="required.software">1.5. 必要的软件</h3>
<div class="sect3">
<h4 id="_jdk_8">1.5.1. JDK 8+</h4>
<div class="paragraph">
<p>运行Flowable需要JDK 8或以上版本。可以访问 <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">Oracle Java SE downloads页面</a> 点击“Download JDK”按钮获取。该页面上也有安装指导。安装完成后，可以执行 <code>java -version</code> 。能看到JDK的版本信息就说明安装成功了。</p>
</div>
</div>
<div class="sect3">
<h4 id="_ide">1.5.2. IDE</h4>
<div class="paragraph">
<p>可以自行选择用于Flowable开发的IDE。如果想要使用Flowable Designer，则需要Eclipse Mars或Neon。
到 <a href="http://www.eclipse.org/downloads/">Eclipse下载页面</a>选择Eclipse版本并下载。解压下载的文件，
然后执行<code>eclipse</code>文件夹下的eclipse文件。手册后续有专门一章介绍如何<a href="#eclipseDesignerInstallation">安装我们的Eclipse Designer插件</a>。</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="reporting.problems">1.6. 反馈问题</h3>
<div class="paragraph">
<p>我们希望开发者在报告或提问之前，先看看<a href="http://www.catb.org/~esr/faqs/smart-questions.html">提问的智慧</a>。</p>
</div>
<div class="paragraph">
<p>看完提问的智慧，你可以在<a href="http://forums.flowable.org">用户论坛</a>提问、评论以及提交改进建议，也可以在<a href="https://github.com/flowable/flowable-engine/issues">我们的Github问题跟踪系统</a>创建bug报告。</p>
</div>
</div>
<div class="sect2">
<h3 id="experimental">1.7. 实验性功能</h3>
<div class="paragraph">
<p>标记有<strong>[实验性]</strong>的章节介绍的功能还不够稳定。</p>
</div>
<div class="paragraph">
<p><code>.impl.</code>包下的类都是内部实现类，不保证稳定。但是，在用户手册中作为配置参数介绍的类则是被官方支持的，可以保证稳定。</p>
</div>
</div>
<div class="sect2">
<h3 id="internal">1.8. 内部实现类</h3>
<div class="paragraph">
<p>在JAR文件中，所有<code>.impl.</code>包下的类（比如<code>org.flowable.engine.impl.db</code>）都是实现类，只应在内部使用。实现类中的所有类或接口都不保证稳定。</p>
</div>
</div>
<div class="sect2">
<h3 id="_versioning_strategy">1.9. 版本策略</h3>
<div class="paragraph">
<p>使用三个整数的形式标记版本：<strong>MAJOR.MINOR.MICRO</strong>。其中 <strong>MAJOR</strong>版本代表核心引擎的演进。<strong>MINOR</strong>版本代表新功能与新API。<strong>MICRO</strong>版本代表bug修复与改进。</p>
</div>
<div class="paragraph">
<p>总的来说，Flowable希望在<strong>MINOR</strong>与<strong>MICRO</strong>版本中，对所有非内部实现类保持“源代码兼容性”，即应用可以正确构建，且不改变语义。Flowable也希望在<strong>MINOR</strong>与<strong>MICRO</strong>版本中，保持“二进制兼容性”，即用新版本的Flowable直接替换老版本的Jar文件，仍然可以正常工作。</p>
</div>
<div class="paragraph">
<p>如果在<strong>MINOR</strong>版本中修改了API，将保留原有版本，并使用<em>@Deprecated</em>注解。这种废弃的API将在两个<strong>MINOR</strong>版本之后移除。</p>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="translator_info">2. 配置</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="configuration">2.1. 创建表单引擎</h3>
<div class="paragraph">
<p><em>Flowable 表单引擎的结构与Flowable流程引擎非常相似。 因此，文档的某些部分与其流程引擎对应部分相似.</em></p>
</div>
<div class="paragraph">
<p>Flowable Form引擎通过名为flowable.form.cfg.xml的XML文件进行配置。 请注意，如果您使用的是“springintegration，构建表单引擎的Spring样式”，则这不适用*。</p>
</div>
<div class="paragraph">
<p>获取FormEngine的最简单方法是使用org.flowable.form.engine.FormEngines类：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1</div></td><td class="code"><span></span><span class="tok-n">FormEngine</span> <span class="tok-n">formEngine</span> <span class="tok-o">=</span> <span class="tok-n">FormEngines</span><span class="tok-o">.</span><span class="tok-na">getDefaultFormEngine</span><span class="tok-o">()</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>这将在类路径上查找flowable.form.cfg.xml文件，并根据该文件中的配置构造引擎。 以下代码段显示了示例配置。 以下部分将详细介绍配置属性。</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="xml"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16</div></td><td class="code"><span></span><span class="tok-nt">&lt;beans</span> <span class="tok-na">xmlns=</span><span class="tok-s">&quot;http://www.springframework.org/schema/beans&quot;</span>
       <span class="tok-na">xmlns:xsi=</span><span class="tok-s">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span>
       <span class="tok-na">xsi:schemaLocation=</span><span class="tok-s">&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd&quot;</span><span class="tok-nt">&gt;</span>

  <span class="tok-nt">&lt;bean</span> <span class="tok-na">id=</span><span class="tok-s">&quot;formEngineConfiguration&quot;</span> <span class="tok-na">class=</span><span class="tok-s">&quot;org.flowable.dmn.engine.impl.cfg.StandaloneFormEngineConfiguration&quot;</span><span class="tok-nt">&gt;</span>

    <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;jdbcUrl&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;jdbc:h2:mem:flowable;DB_CLOSE_DELAY=1000&quot;</span> <span class="tok-nt">/&gt;</span>
    <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;jdbcDriver&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;org.h2.Driver&quot;</span> <span class="tok-nt">/&gt;</span>
    <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;jdbcUsername&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;sa&quot;</span> <span class="tok-nt">/&gt;</span>
    <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;jdbcPassword&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;&quot;</span> <span class="tok-nt">/&gt;</span>

    <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;databaseSchemaUpdate&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;true&quot;</span> <span class="tok-nt">/&gt;</span>

  <span class="tok-nt">&lt;/bean&gt;</span>

<span class="tok-nt">&lt;/beans&gt;</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>请注意，配置XML实际上是Spring配置。 这并不意味着Flowable Form只能在Spring环境中使用！ 我们只是在内部利用Spring的解析和依赖注入功能来构建引擎。</p>
</div>
<div class="paragraph">
<p>也可以使用配置文件以编程方式创建FormEngineConfiguration对象。 也可以使用不同的bean id（例如，参见第3行）。</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4
5
6</div></td><td class="code"><span></span><span class="tok-n">FormEngineConfiguration</span><span class="tok-o">.</span>
  <span class="tok-nf">createFormEngineConfigurationFromResourceDefault</span><span class="tok-o">();</span>
  <span class="tok-n">createFormEngineConfigurationFromResource</span><span class="tok-o">(</span><span class="tok-n">String</span> <span class="tok-n">resource</span><span class="tok-o">);</span>
  <span class="tok-n">createFormEngineConfigurationFromResource</span><span class="tok-o">(</span><span class="tok-n">String</span> <span class="tok-n">resource</span><span class="tok-o">,</span> <span class="tok-n">String</span> <span class="tok-n">beanName</span><span class="tok-o">);</span>
  <span class="tok-n">createFormEngineConfigurationFromInputStream</span><span class="tok-o">(</span><span class="tok-n">InputStream</span> <span class="tok-n">inputStream</span><span class="tok-o">);</span>
  <span class="tok-n">createFormEngineConfigurationFromInputStream</span><span class="tok-o">(</span><span class="tok-n">InputStream</span> <span class="tok-n">inputStream</span><span class="tok-o">,</span> <span class="tok-n">String</span> <span class="tok-n">beanName</span><span class="tok-o">);</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>也可以不使用配置文件，并基于创建配置
默认值（有关更多信息，请参阅&lt;&lt; configurationClasses类&gt;&gt;）。</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2</div></td><td class="code"><span></span><span class="tok-n">FormEngineConfiguration</span><span class="tok-o">.</span><span class="tok-na">createStandaloneFormEngineConfiguration</span><span class="tok-o">();</span>
<span class="tok-n">FormEngineConfiguration</span><span class="tok-o">.</span><span class="tok-na">createStandaloneInMemFormEngineConfiguration</span><span class="tok-o">();</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>所有这些FormEngineConfiguration.createXXX（）方法返回一个FormEngineConfiguration，如果需要可以进一步调整。 调用buildFormEngine（）操作后，创建一个FormEngine：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4</div></td><td class="code"><span></span><span class="tok-n">FormEngine</span> <span class="tok-n">formEngine</span> <span class="tok-o">=</span> <span class="tok-n">FormEngineConfiguration</span><span class="tok-o">.</span><span class="tok-na">createStandaloneInMemFormEngineConfiguration</span><span class="tok-o">()</span>
  <span class="tok-o">.</span><span class="tok-na">setDatabaseSchemaUpdate</span><span class="tok-o">(</span><span class="tok-n">FormEngineConfiguration</span><span class="tok-o">.</span><span class="tok-na">DB_SCHEMA_UPDATE_FALSE</span><span class="tok-o">)</span>
  <span class="tok-o">.</span><span class="tok-na">setJdbcUrl</span><span class="tok-o">(</span><span class="tok-s">&quot;jdbc:h2:mem:my-own-db;DB_CLOSE_DELAY=1000&quot;</span><span class="tok-o">)</span>
  <span class="tok-o">.</span><span class="tok-na">buildFormEngine</span><span class="tok-o">();</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="configurationRoot">2.2. 表单引擎配置类</h3>
<div class="paragraph">
<p>flowable.form.cfg.xml文件必须包含一个具有id值为 <em>formEngineConfiguration</em> 的bean。</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="xml"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1</div></td><td class="code"><span></span> <span class="tok-nt">&lt;bean</span> <span class="tok-na">id=</span><span class="tok-s">&quot;formEngineConfiguration&quot;</span> <span class="tok-na">class=</span><span class="tok-s">&quot;org.flowable.form.engine.impl.cfg.StandaloneFormEngineConfiguration&quot;</span><span class="tok-nt">&gt;</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>然后使用该bean构造FormEngine。</p>
</div>
<div class="ulist">
<ul>
<li>
<p><strong>org.flowable.form.engine.impl.cfg.StandaloneFormEngineConfiguration</strong>: the process engine is used in a standalone way. Flowable will take care of the transactions. By default, the database will only be checked when the engine boots (and an exception is thrown if there is no Flowable Form schema or the schema version is incorrect).</p>
</li>
<li>
<p><strong>org.flowable.form.engine.impl.cfg.StandaloneInMemFormEngineConfiguration</strong>: this is a convenience class for unit testing purposes. Flowable Form will take care of the transactions. An H2 in-memory database is used by default. The database will be created and dropped when the engine boots and shuts down. When using this, probably no additional configuration is needed).</p>
</li>
<li>
<p><strong>org.flowable.form.spring.SpringFormEngineConfiguration</strong>: To be used when the Form engine is used in a Spring environment.  See <a href="#springintegration">the Spring integration section</a> for more information.</p>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="_插件方式集成流程引擎">2.3. 插件方式集成流程引擎</h3>
<div class="paragraph">
<p>除了在独立模式下运行外，还可以将表单引擎插入流程引擎。 这使得流程引擎可以识别它和其他引擎。 例如，这可以将包含BPMN模型和DMN模型的工件部署到流程引擎的部署服务API。</p>
</div>
<div class="paragraph">
<p>要使流程引擎知道表单引擎，需要将org.flowable.dmn.engine.configurator.FormEngineConfigurator添加到流程引擎配置中的配置程序列表中。 此配置程序是flowable-form-engine-configurator模块的一部分。</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="xml"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20</div></td><td class="code"><span></span><span class="tok-nt">&lt;bean</span> <span class="tok-na">id=</span><span class="tok-s">&quot;processEngineConfiguration&quot;</span> <span class="tok-na">class=</span><span class="tok-s">&quot;org.flowable.engine.impl.cfg.StandaloneProcessEngineConfiguration&quot;</span><span class="tok-nt">&gt;</span>

    <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;configurators&quot;</span><span class="tok-nt">&gt;</span>
      <span class="tok-nt">&lt;list&gt;</span>
        <span class="tok-nt">&lt;ref</span> <span class="tok-na">bean=</span><span class="tok-s">&quot;formEngineConfigurator&quot;</span> <span class="tok-nt">/&gt;</span>
      <span class="tok-nt">&lt;/list&gt;</span>
    <span class="tok-nt">&lt;/property&gt;</span>
    ...
<span class="tok-nt">&lt;/bean&gt;</span>

<span class="tok-nt">&lt;bean</span> <span class="tok-na">id=</span><span class="tok-s">&quot;formEngineConfiguration&quot;</span> <span class="tok-na">class=</span><span class="tok-s">&quot;org.flowable.form.engine.impl.cfg.StandaloneFormEngineConfiguration&quot;</span><span class="tok-nt">&gt;</span>
    <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;jdbcUrl&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;jdbc:h2:mem:flowable;DB_CLOSE_DELAY=1000&quot;</span> <span class="tok-nt">/&gt;</span>
    <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;jdbcDriver&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;org.h2.Driver&quot;</span> <span class="tok-nt">/&gt;</span>
    <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;jdbcUsername&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;sa&quot;</span> <span class="tok-nt">/&gt;</span>
    <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;jdbcPassword&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;&quot;</span> <span class="tok-nt">/&gt;</span>
<span class="tok-nt">&lt;/bean&gt;</span>

<span class="tok-nt">&lt;bean</span> <span class="tok-na">id=</span><span class="tok-s">&quot;formEngineConfigurator&quot;</span> <span class="tok-na">class=</span><span class="tok-s">&quot;org.flowable.form.engine.configurator.FormEngineConfigurator&quot;</span><span class="tok-nt">&gt;</span>
    <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;formEngineConfiguration&quot;</span> <span class="tok-na">ref=</span><span class="tok-s">&quot;formEngineConfiguration&quot;</span> <span class="tok-nt">/&gt;</span>
<span class="tok-nt">&lt;/bean&gt;</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="databaseConfiguration">2.4. 数据源配置</h3>
<div class="paragraph">
<p>有两种方法可以配置Flowable 表单引擎将使用的数据库。 第一个选项是定义数据库的JDBC属性：
* <strong>jdbcUrl</strong>: 数据库的JDBC URL.
* <strong>jdbcDriver</strong>: 为特定数据库类型实现驱动程序.
* <strong>jdbcUsername</strong>: 用于连接数据库的用户名.
* <strong>jdbcPassword</strong>: 用于连接数据库的密码.</p>
</div>
<div class="paragraph">
<p>基于提供的JDBC属性构造的数据源将具有默认链接： http：//www.mybatis.org/ [MyBatis]连接池设置。 可以选择设置以下属性来调整该连接池（取自MyBatis文档）：</p>
</div>
<div class="ulist">
<ul>
<li>
<p><strong>jdbcMaxActiveConnections</strong>: 连接池中处于被使用状态的连接的最大值。默认为10。</p>
</li>
<li>
<p><strong>jdbcMaxIdleConnections</strong>: 连接池中处于空闲状态的连接的最大值。</p>
</li>
<li>
<p><strong>jdbcMaxCheckoutTime</strong>: 连接被取出使用的最长时间，超过时间会被强制回收。 默认为20000（20秒）。</p>
</li>
<li>
<p><strong>jdbcMaxWaitTime</strong>:这是一个底层配置，让连接池可以在长时间无法获得连接时， 打印一条日志，并重新尝试获取一个连接。（避免因为错误配置导致沉默的操作失败）。 默认为20000（20秒）。</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>示例数据库配置：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="xml"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4</div></td><td class="code"><span></span><span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;jdbcUrl&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;jdbc:h2:mem:flowable_dmn;DB_CLOSE_DELAY=1000&quot;</span> <span class="tok-nt">/&gt;</span>
<span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;jdbcDriver&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;org.h2.Driver&quot;</span> <span class="tok-nt">/&gt;</span>
<span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;jdbcUsername&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;sa&quot;</span> <span class="tok-nt">/&gt;</span>
<span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;jdbcPassword&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;&quot;</span> <span class="tok-nt">/&gt;</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>我们的基准测试表明，在处理大量并发请求时，MyBatis连接池可能扛不住。 因此，我们建议使用javax.sql.DataSource实现并将其注入流程引擎配置（例如HikariCP，Tomcat JDBC连接池等）：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="xml"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12</div></td><td class="code"><span></span><span class="tok-nt">&lt;bean</span> <span class="tok-na">id=</span><span class="tok-s">&quot;dataSource&quot;</span> <span class="tok-na">class=</span><span class="tok-s">&quot;org.apache.commons.dbcp.BasicDataSource&quot;</span> <span class="tok-nt">&gt;</span>
  <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;driverClassName&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;com.mysql.jdbc.Driver&quot;</span> <span class="tok-nt">/&gt;</span>
  <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;url&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;jdbc:mysql://localhost:3306/flowable_dmn&quot;</span> <span class="tok-nt">/&gt;</span>
  <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;username&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;flowable&quot;</span> <span class="tok-nt">/&gt;</span>
  <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;password&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;flowable&quot;</span> <span class="tok-nt">/&gt;</span>
  <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;defaultAutoCommit&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;false&quot;</span> <span class="tok-nt">/&gt;</span>
<span class="tok-nt">&lt;/bean&gt;</span>

<span class="tok-nt">&lt;bean</span> <span class="tok-na">id=</span><span class="tok-s">&quot;formEngineConfiguration&quot;</span> <span class="tok-na">class=</span><span class="tok-s">&quot;org.flowable.form.engine.impl.cfg.StandaloneFormEngineConfiguration&quot;</span><span class="tok-nt">&gt;</span>

    <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;dataSource&quot;</span> <span class="tok-na">ref=</span><span class="tok-s">&quot;dataSource&quot;</span> <span class="tok-nt">/&gt;</span>
    ...
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>请注意，Flowable 表单不附带允许您定义此类数据源的库。 所以你必须确保库在你的类路径上。</p>
</div>
<div class="paragraph">
<p>无论您使用的是JDBC还是数据源方法，都可以设置以下属性：</p>
</div>
<div class="ulist">
<ul>
<li>
<p><strong>databaseType</strong>: 数据库类型，可以是如下的值（h2, mysql, oracle, postgres, mssql, db2）.</p>
</li>
<li>
<p><strong>databaseSchemaUpdate</strong>:允许您设置策略以在表单引擎启动和关闭时如何处理数据库表.</p>
<div class="ulist">
<ul>
<li>
<p><code>false</code> (default): 在创建表单引擎时检查库模式的版本，如果版本不匹配则抛出异常.</p>
</li>
<li>
<p><code>true</code>: 在构建表单引擎时，执行检查并在必要时执行模式的更新。 如果schema不存在，则创建它.</p>
</li>
<li>
<p><code>create-drop</code>: 在创建表单引擎时创建schema，并在关闭流程引擎时删除schema.</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="jndiDatasourceConfig">2.5. JNDI方式数据源配置</h3>
<div class="paragraph">
<p>默认情况下，Flowable Form的数据库配置包含在每个Web应用程序的WEB-INF/classes中的db.properties文件中。 这并不总是理想的，因为它
要求用户修改Flowable源中的db.properties并重新编译WAR文件，或者在每次部署时分解WAR并修改db.properties。
通过使用JNDI（Java命名和目录接口）获取数据库连接，连接完全由Servlet容器管理，并且可以在WAR部署之外管理配置。 这也允许对db.properties文件提供的连接参数进行更多控制。</p>
</div>
<div class="sect3">
<h4 id="jndi_configuration">2.5.1. 配置</h4>
<div class="paragraph">
<p>JNDI数据源的配置将根据您使用的servlet容器应用程序而有所不同。 以下说明适用于Tomcat，但对于其他容器应用程序，请参阅容器应用程序的文档。</p>
</div>
<div class="paragraph">
<p>如果使用Tomcat，则在$CATALINA_BASE/conf/[enginename]/[hostname]/[warname].xml中配置JNDI资源（对于Flowable UI，这通常是$CATALINA_BASE/conf/Catalina/localhost/flowable-app。XML）。 首次部署应用程序时，将从Flowable WAR文件复制默认上下文，因此如果已存在，则需要替换它。 例如，要更改JNDI资源以便应用程序连接到MySQL而不是H2，请将文件更改为以下内容：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="xml"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16</div></td><td class="code"><span></span><span class="tok-cp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
    <span class="tok-nt">&lt;Context</span> <span class="tok-na">antiJARLocking=</span><span class="tok-s">&quot;true&quot;</span> <span class="tok-na">path=</span><span class="tok-s">&quot;/flowable-app&quot;</span><span class="tok-nt">&gt;</span>
        <span class="tok-nt">&lt;Resource</span> <span class="tok-na">auth=</span><span class="tok-s">&quot;Container&quot;</span>
            <span class="tok-na">name=</span><span class="tok-s">&quot;jdbc/flowableDB&quot;</span>
            <span class="tok-na">type=</span><span class="tok-s">&quot;javax.sql.DataSource&quot;</span>
            <span class="tok-na">description=</span><span class="tok-s">&quot;JDBC DataSource&quot;</span>
            <span class="tok-na">url=</span><span class="tok-s">&quot;jdbc:mysql://localhost:3306/flowable&quot;</span>
            <span class="tok-na">driverClassName=</span><span class="tok-s">&quot;com.mysql.jdbc.Driver&quot;</span>
            <span class="tok-na">username=</span><span class="tok-s">&quot;sa&quot;</span>
            <span class="tok-na">password=</span><span class="tok-s">&quot;&quot;</span>
            <span class="tok-na">defaultAutoCommit=</span><span class="tok-s">&quot;false&quot;</span>
            <span class="tok-na">initialSize=</span><span class="tok-s">&quot;5&quot;</span>
            <span class="tok-na">maxWait=</span><span class="tok-s">&quot;5000&quot;</span>
            <span class="tok-na">maxActive=</span><span class="tok-s">&quot;120&quot;</span>
            <span class="tok-na">maxIdle=</span><span class="tok-s">&quot;5&quot;</span><span class="tok-nt">/&gt;</span>
        <span class="tok-nt">&lt;/Context&gt;</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_jndi_属性">2.5.2. JNDI 属性</h4>
<div class="paragraph">
<p>要配置JNDI数据源，请在Flowable UI的属性文件中使用以下属性：</p>
</div>
<div class="ulist">
<ul>
<li>
<p>spring.datasource.jndi-name=: 数据源的JNDI名称.</p>
</li>
<li>
<p>datasource.jndi.resourceRef: 设置查询是否发生在J2EE容器中，换句话说，如果JNDI名称尚未包含它，则需要添加前缀“java：comp/env/”。 默认为“true”.</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect2">
<h3 id="supporteddatabases">2.6. 支持的数据库厂商</h3>
<div class="paragraph">
<p>下面列出了Flowable用于引用数据库的类型（区分大小写！）。</p>
</div>
<table id="databaseTypes" class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">数据库类型</th>
<th class="tableblock halign-left valign-top">连接URL</th>
<th class="tableblock halign-left valign-top">Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">h2</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">jdbc:h2:tcp://localhost/flowable_form</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Default configured database</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">mysql</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">jdbc:mysql://localhost:3306/flowable_form?autoReconnect=true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Tested using mysql-connector-java database driver</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">oracle</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">jdbc:oracle:thin:@localhost:1521:xe</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">postgres</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">jdbc:postgresql://localhost:5432/flowable_form</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">db2</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">jdbc:db2://localhost:50000/flowable_form</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">mssql</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">jdbc:sqlserver://localhost:1433;databaseName=flowable_form (jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver) <em>OR</em> jdbc:jtds:sqlserver://localhost:1433/flowable_form (jdbc.driver=net.sourceforge.jtds.jdbc.Driver)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Tested using Microsoft JDBC Driver 4.0 (sqljdbc4.jar) and JTDS Driver</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="creatingDatabaseTable">2.7. 创建表</h3>
<div class="paragraph">
<p>Flowable表单使用链接：http://www.liquibase.org[Liquibase]来跟踪，管理和应用数据库架构更改。
为数据库创建数据库表的最简单方法是：</p>
</div>
<div class="ulist">
<ul>
<li>
<p>在classpath中添加flowable-form-engine JARS包</p>
</li>
<li>
<p>添加合适的数据库驱动</p>
</li>
<li>
<p>将Flowable配置文件（flowable.form.cfg.xml）添加到类路径中，指向您的数据库（请参阅&lt;&lt; databaseConfiguration，数据库配置部分&gt;&gt;）</p>
</li>
<li>
<p>执行DbSchemaCreate类的main方法</p>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="database.tables.explained">2.8. 数据库表名称解释</h3>
<div class="paragraph">
<p>Flowable表单的数据库名称都以ACT_FO_开头。</p>
</div>
<div class="ulist">
<ul>
<li>
<p>ACT_FO_DATABASECHANGELOG: Liquibase使用此表来跟踪已运行的changesets.</p>
</li>
<li>
<p>ACT_FO_DATABASECHANGELOGLOCK: Liquibase使用此表来确保一次只运行一个Liquibase实例.</p>
</li>
<li>
<p>ACT_FO_FORM_DEFINITION: 此表包含已部署的表单定义的定义信息.</p>
</li>
<li>
<p>ACT_FO_FORM_INSTANCE: 此表包含具有已由用户填写的值的表单实例.</p>
</li>
<li>
<p>ACT_FO_FORM_DEPLOYMENT: 该表包含部署元数据.</p>
</li>
<li>
<p>ACT_FO_FORM_RESOURCE: 此表包含表单定义资源.</p>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="databaseUpgrade">2.9. 数据库升级</h3>
<div class="paragraph">
<p>在运行升级之前，请确保备份数据库（使用数据库备份功能）。</p>
</div>
<div class="paragraph">
<p>默认情况下，每次创建流程引擎时都会执行版本检查。 这通常在应用程序或Flowable Web应用程序的引导时发生一次。 如果Flowable库注意到库版本与Flowable数据库表的版本之间的差异，则抛出异常。</p>
</div>
<div class="paragraph">
<p>要升级，必须首先将以下配置属性放在flowable.form.cfg.xml配置文件中：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="xml"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4
5
6
7
8
9</div></td><td class="code"><span></span><span class="tok-nt">&lt;beans</span> <span class="tok-nt">&gt;</span>

  <span class="tok-nt">&lt;bean</span> <span class="tok-na">id=</span><span class="tok-s">&quot;formEngineConfiguration&quot;</span> <span class="tok-na">class=</span><span class="tok-s">&quot;org.flowable.form.engine.impl.cfg.StandaloneFormEngineConfiguration&quot;</span><span class="tok-nt">&gt;</span>
    <span class="tok-c">&lt;!-- ... --&gt;</span>
    <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;databaseSchemaUpdate&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;true&quot;</span> <span class="tok-nt">/&gt;</span>
    <span class="tok-c">&lt;!-- ... --&gt;</span>
  <span class="tok-nt">&lt;/bean&gt;</span>

<span class="tok-nt">&lt;/beans&gt;</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="literalblock">
<div class="content">
<pre>使用databaseSchemaUpdate设置为true即可。</pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="formDefinitionCacheConfiguration">2.10. 部署缓存配置</h3>
<div class="paragraph">
<p>所有定义都被缓存（在解析之后），以避免每次需要表单时都访问数据库，并且表单数据不会更改。 默认情况下，此缓存没有限制。 要限制表单缓存使用的容器大小，请添加以下属性：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="xml"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1</div></td><td class="code"><span></span><span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;formCacheLimit&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;10&quot;</span> <span class="tok-nt">/&gt;</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>设置此属性将使默认的LRU算法。 当然，此属性的“最佳”值取决于存储的表单总量和运行时实际使用的表单数。</p>
</div>
<div class="paragraph">
<p>您也可以注入自己的缓存实现。 自定义类必须实现org.flowable.form.engine.impl.persistence.deploy.DeploymentCache接口的bean：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="xml"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3</div></td><td class="code"><span></span><span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;formCache&quot;</span><span class="tok-nt">&gt;</span>
  <span class="tok-nt">&lt;bean</span> <span class="tok-na">class=</span><span class="tok-s">&quot;org.flowable.MyCache&quot;</span> <span class="tok-nt">/&gt;</span>
<span class="tok-nt">&lt;/property&gt;</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="loggingConfiguration">2.11. 日志</h3>
<div class="paragraph">
<p>所有日志记录（flowable，spring，mybatis，&#8230;&#8203;）都通过SLF4J进行路由，并允许选择您选择的日志记录实现。</p>
</div>
<div class="paragraph">
<p>*默认情况下，flowable-dmn-engine依赖项中不存在SFL4J-binding jar，这应该在项目中添加，以便使用您选择的日志框架。
*如果没有添加实现jar，SLF4J将使用NOP-logger，不记录任何内容，除了警告不会记录任何内容。 有关这些绑定链接的更多信息，请访问：http://www.slf4j.org/codes.html#StaticLoggerBinder[<a href="http://www.slf4j.org/codes.html#StaticLoggerBinder" class="bare">http://www.slf4j.org/codes.html#StaticLoggerBinder</a>]。
使用Maven，添加例如这样的依赖（这里使用log4j），请注意您仍然需要添加一个版本：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="xml"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4</div></td><td class="code"><span></span><span class="tok-nt">&lt;dependency&gt;</span>
  <span class="tok-nt">&lt;groupId&gt;</span>org.slf4j<span class="tok-nt">&lt;/groupId&gt;</span>
  <span class="tok-nt">&lt;artifactId&gt;</span>slf4j-log4j12<span class="tok-nt">&lt;/artifactId&gt;</span>
<span class="tok-nt">&lt;/dependency&gt;</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>flowable-ui和flowable-rest webapps配置了使用Log4j binding.。 在运行所有flowable-*模块的测试时也使用Log4j。</p>
</div>
<div class="paragraph">
<p>在类路径中使用带有commons-logging的容器时的重要注意事项：
为了通过SLF4J路由spring-logging，使用了一个桥接器（参见链接：http://www.slf4j.org/legacy.html#jclOverSLF4J[<a href="http://www.slf4j.org/legacy.html#jclOverSLF4J" class="bare">http://www.slf4j.org/legacy.html#jclOverSLF4J</a>]）。
如果您的容器提供了commons-logging实现，请按照此页面上的说明进行操作：http://www.slf4j.org/codes.html#release[<a href="http://www.slf4j.org/codes.html#release" class="bare">http://www.slf4j.org/codes.html#release</a>]确保稳定性。</p>
</div>
<div class="paragraph">
<p>使用Maven时的示例（省略版本）：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="xml"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4</div></td><td class="code"><span></span><span class="tok-nt">&lt;dependency&gt;</span>
  <span class="tok-nt">&lt;groupId&gt;</span>org.slf4j<span class="tok-nt">&lt;/groupId&gt;</span>
  <span class="tok-nt">&lt;artifactId&gt;</span>jcl-over-slf4j<span class="tok-nt">&lt;/artifactId&gt;</span>
<span class="tok-nt">&lt;/dependency&gt;</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="chapterApi">3. Flowable 表单 API</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="apiEngine">3.1. 表单引擎 API 与服务类</h3>
<div class="paragraph">
<p>表单引擎 API 是与 Flowable 表单交互的最常用方式。核心起点是可以通过 <a href="#configuration">配置部分</a> 中描述的几种方式创建的<code>表单引擎</code>。从表单引擎中，您能够获得各种其他服务类。</p>
</div>
<div class="paragraph">
<p>表单引擎和其服务类对象是线程安全的，因此您可以为整个服务保留其中一个引用。</p>
</div>
<div class="imageblock" style="text-align: center">
<div class="content">
<img src="images/api.services.png" alt="api.services">
</div>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4
5</div></td><td class="code"><span></span><span class="tok-n">FormEngine</span> <span class="tok-n">formEngine</span> <span class="tok-o">=</span> <span class="tok-n">FormEngines</span><span class="tok-o">.</span><span class="tok-na">getDefaultFormEngine</span><span class="tok-o">();</span>
<span class="tok-n">FormRuleService</span> <span class="tok-n">formRuleService</span> <span class="tok-o">=</span> <span class="tok-n">formEngine</span><span class="tok-o">.</span><span class="tok-na">getFormRuleService</span><span class="tok-o">();</span>
<span class="tok-n">FormRepositoryService</span> <span class="tok-n">formRepositoryService</span> <span class="tok-o">=</span> <span class="tok-n">formEngine</span><span class="tok-o">.</span><span class="tok-na">getFormRepositoryService</span><span class="tok-o">();</span>
<span class="tok-n">FormService</span> <span class="tok-n">formService</span> <span class="tok-o">=</span> <span class="tok-n">formEngine</span><span class="tok-o">.</span><span class="tok-na">getFormService</span><span class="tok-o">();</span>
<span class="tok-n">FormManagementService</span> <span class="tok-n">formManagementService</span> <span class="tok-o">=</span> <span class="tok-n">formEngine</span><span class="tok-o">.</span><span class="tok-na">getFormManagementService</span><span class="tok-o">();</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p><code>FormEngines.getDefaultFormEngine()</code> 将在第一次调用时初始化并构建一个表单引擎，之后调用总是返回相同的表单引擎。使用 <code>FormEngines.init()</code> 和 <code>FormEngines.destroy()</code> 可以正确创建和关闭所有表单引擎。</p>
</div>
<div class="paragraph">
<p>FormEngines类将扫描所有 <code>flowable.form.cfg.xml</code> 和 <code>flowable-form-context.xml</code> 配置文件。对于所有 <code>flowable.form.cfg.xml</code> 配置文件，表单引擎将以典型的Flowable方式构建：<code>FormEngineConfiguration.createFormEngineConfigurationFromInputStream(inputStream).buildFormEngine()</code>。对于所有 <code>flowable-form-context.xml</code> 配置文件，表单引擎将以Spring方式构建：首先创建Spring应用程序上下文，然后表单引擎会从该应用程序上下文中获取。</p>
</div>
<div class="paragraph">
<p>所有的服务类均是无状态的。这意味着您可以轻松地在群集中的多个节点上运行Flowable表单模块，每个节点都连接同一个数据库，而不必担心哪台机器实际执行了旧的调用。对任何服务类的任何调用都是幂等的，无论它在何处执行。</p>
</div>
<div class="paragraph">
<p><strong>FormRepositoryService</strong> 可能是Flowable表单引擎工作时所需的第一个服务类。该服务类提供用于管理和使用<code>部署文件</code>和<code>表单定义</code>的操作。表单定义是表单模型的根本概念（表单定义的主要概念在 <a href="#form-introduction">表单介绍部分</a>中进行了解释）。</p>
</div>
<div class="paragraph">
<p><code>部署文件</code>是 Flowable 表单引擎中的打包最小单元。一个部署文件中可以包含多个表单定义的JSON 文件。发布一个部署文件意味着将其部署到引擎相关表中，在该引擎中，所有表单定义在存储到数据库之前都会被校验和解析。从那一刻起，系统会感知到这个部署文件，并且部署文件中包含的任何表单都可以被执行。</p>
</div>
<div class="paragraph">
<p>此外，这个服务类允许您：</p>
</div>
<div class="ulist">
<ul>
<li>
<p>查询引擎已知的表单定义的部署文件。</p>
</li>
<li>
<p>检索表单定义的POJO类，它可用于使用Java中而不是JSON数据结构。</p>
</li>
</ul>
</div>
<div class="paragraph">
<p><strong>FormService</strong> 提供了使用用户为特定表单定义填写的值来创建表单实例的方法。它也可以被用于查询表单实例。</p>
</div>
<div class="paragraph">
<p>使用 Flowable 表单模块编写自定义应用程序时，通常不需要 <strong>FormManagementService</strong> 。它允许您检索有关引擎版本，数据库表和表元数据的信息。</p>
</div>
</div>
<div class="sect2">
<h3 id="_异常策略">3.2. 异常策略</h3>
<div class="paragraph">
<p>Flowable中的基础异常是 <code>org.flowable.engine.FlowableException</code>，这是一个未经检查的异常。这种异常可以被API随时抛出，其他特定方法中发生的“预期中的”异常被记录在<a href="http://www.flowable.org/docs/javadocs/index.html">文档</a>中。例如 <code>FormRuleService</code> 的摘录：</p>
</div>
<div class="paragraph">
<p>尽管我们想要避免一个大的异常层次结构，下列的异常子类仍会在特定情况下被抛出。在流程执行或 API 调用期间发生的所有其他错误都不适合下面可能发生的异常，这些错误将作为常规 <code>FlowableExceptions</code> 抛出。</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>FlowableOptimisticLockingException</code>：当由同一数据条目的并发访问引起的数据存储中发生乐观锁问题时抛出。</p>
</li>
<li>
<p><code>FlowableClassLoadingException</code>：当未找到请求加载的类或加载时发生错误时抛出。</p>
</li>
<li>
<p><code>FlowableObjectNotFoundException</code>：当请求或操作的对象不存在时抛出。</p>
</li>
<li>
<p><code>FlowableIllegalArgumentException</code>：这个异常表示在Flowable 表单 API调用中使用了非法参数、在引擎的配置中配置了非法值或者提供了非法值。</p>
</li>
</ul>
</div>
</div>
<div class="sect2">
<h3 id="queryAPI">3.3. 查询 API</h3>
<div class="paragraph">
<p>有两种方法可以从引擎查询数据：使用查询 API 和本地查询。查询 API 允许您使用流畅的 API 编写完全类型安全的查询。您可以为查询添加各种查询条件（所有条件共同应用逻辑与）与一个排序参数。示例如下：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4</div></td><td class="code"><span></span><span class="tok-n">List</span><span class="tok-o">&lt;</span><span class="tok-n">FormDeployment</span><span class="tok-o">&gt;</span> <span class="tok-n">formDeployments</span> <span class="tok-o">=</span> <span class="tok-n">formRepositoryService</span><span class="tok-o">.</span><span class="tok-na">createDeploymentQuery</span><span class="tok-o">()</span>
    <span class="tok-o">.</span><span class="tok-na">deploymentNameLike</span><span class="tok-o">(</span><span class="tok-s">&quot;deployment%&quot;</span><span class="tok-o">)</span>
    <span class="tok-o">.</span><span class="tok-na">orderByDeployTime</span><span class="tok-o">()</span>
    <span class="tok-o">.</span><span class="tok-na">list</span><span class="tok-o">();</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>有时您需要更强大的查询操作，例如，使用或运算符或使用查询 API 无法表达的查询。对于这些情况，我们引入了本地查询，允许您编写自己的 SQL 语句进行查询。返回类型由您使用的查询对象定义，数据会映射到正确的对象，例如 Deployment、FormInstance 等。由于查询将在数据库中触发，因此必须使用在数据库中定义的表名和列名，这需要一些有关内部数据结构的知识，建议谨慎使用本机查询。表名可以通过 API 进行检索，以使依赖尽可能小。</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4
5
6
7
8</div></td><td class="code"><span></span>
<span class="tok-kt">long</span> <span class="tok-n">count</span> <span class="tok-o">=</span> <span class="tok-n">formRepositoryService</span><span class="tok-o">.</span><span class="tok-na">createNativeDeploymentQuery</span><span class="tok-o">()</span>
    <span class="tok-o">.</span><span class="tok-na">sql</span><span class="tok-o">(</span><span class="tok-s">&quot;SELECT count(*) FROM &quot;</span> <span class="tok-o">+</span> <span class="tok-n">formManagementService</span><span class="tok-o">.</span><span class="tok-na">getTableName</span><span class="tok-o">(</span><span class="tok-n">FormDeploymentEntity</span><span class="tok-o">.</span><span class="tok-na">class</span><span class="tok-o">)</span> <span class="tok-o">+</span> <span class="tok-s">&quot; D1, &quot;</span>
        <span class="tok-o">+</span> <span class="tok-n">formManagementService</span><span class="tok-o">.</span><span class="tok-na">getTableName</span><span class="tok-o">(</span><span class="tok-n">FormDefinitionEntity</span><span class="tok-o">.</span><span class="tok-na">class</span><span class="tok-o">)</span> <span class="tok-o">+</span> <span class="tok-s">&quot; D2 &quot;</span>
        <span class="tok-o">+</span> <span class="tok-s">&quot;WHERE D1.ID_ = D2.DEPLOYMENT_ID_ &quot;</span>
        <span class="tok-o">+</span> <span class="tok-s">&quot;AND D1.ID_ = #{deploymentId}&quot;</span><span class="tok-o">)</span>
    <span class="tok-o">.</span><span class="tok-na">parameter</span><span class="tok-o">(</span><span class="tok-s">&quot;deploymentId&quot;</span><span class="tok-o">,</span> <span class="tok-n">deployment</span><span class="tok-o">.</span><span class="tok-na">getId</span><span class="tok-o">())</span>
    <span class="tok-o">.</span><span class="tok-na">count</span><span class="tok-o">();</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="apiUnitTesting">3.4. 单元测试</h3>
<div class="paragraph">
<p>由于 Flowable 表单模块是一个嵌入式的 Java 引擎，因此为表单定义编写单元测试就像编写常规单元测试一样简单。</p>
</div>
<div class="paragraph">
<p>Flowable 支持 JUnit 4、JUnit 5 做单元测试。</p>
</div>
<div class="paragraph">
<p>在编写JUnit 5单元测试时，可以使用 <code>org.flowable.form.engine.test.FlowableFormExtension</code>。
通过此扩展，表单引擎和服务类可用作测试和生命周期方法的参数。
使用此<code>拓展</code>将启用 <code>org.flowable.form.engine.test.FormDeploymentAnnotation</code> 注解（请参阅下面有关其使用和配置的说明），它将在类路径中查找默认配置文件。
使用相同的配置文件时，表单引擎会在多个单元测试中静态缓存。</p>
</div>
<div class="paragraph">
<p>当使用 <code>@FormDeploymentAnnotation</code> 注解测试方法时，在每次测试之前，将发布在+ FormDeploymentAnnotation＃resources +中定义的表单文件。
如果没有定义资源，将发布与测试类在同一包中的 <code>testClassName.testMethod.form</code> 形式的资源文件。
在测试结束时，部署文件将会删除，包括所有相关的表单实例、定义等。
有关更多信息，请参阅 <code>FormDeploymentAnnotation</code> 类。</p>
</div>
<div class="paragraph">
<p>在编写JUnit 4单元测试时，可以使用 <code>org.flowable.form.engine.test.FlowableFormRule</code> 规则。通过这个规则，表单引擎和服务类可以通过 getter 方法获得。包括这个<code>规则</code>将允许使用 <code>org.flowable.form.engine.test.FormDeploymentAnnotation</code> 注解（参见上面有关其使用和配置的说明），它将在类路径上查找默认配置文件。使用相同的配置文件时，表单引擎会在多个单元测试中静态缓存。
也可以为规则提供自定义的引擎配置。</p>
</div>
<div class="paragraph">
<p>以下代码片段显示了使用 JUnit 5单元测试的示例。</p>
</div>
<div class="listingblock">
<div class="title">JUnit 5 test</div>
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23</div></td><td class="code"><span></span><span class="tok-nd">@ExtendWith</span><span class="tok-o">(</span><span class="tok-n">FlowableFormExtension</span><span class="tok-o">.</span><span class="tok-na">class</span><span class="tok-o">)</span>
<span class="tok-c1">// 如果需要自定义表单配置，则应取消注释下面的部分</span>
<span class="tok-c1">//@FormConfigurationResource(&quot;custom1.flowable.form.cfg.xml&quot;)</span>
<span class="tok-kd">class</span> <span class="tok-nc">MyFormDefinitionTest</span> <span class="tok-o">{</span>

  <span class="tok-kd">private</span> <span class="tok-n">FormEngine</span> <span class="tok-n">formEngine</span><span class="tok-o">;</span>

  <span class="tok-nd">@BeforeEach</span>
  <span class="tok-kt">void</span> <span class="tok-nf">setUp</span><span class="tok-o">(</span><span class="tok-n">FormEngine</span> <span class="tok-n">formEngine</span><span class="tok-o">)</span> <span class="tok-o">{</span>
    <span class="tok-k">this</span><span class="tok-o">.</span><span class="tok-na">formEngine</span> <span class="tok-o">=</span> <span class="tok-n">formEngine</span><span class="tok-o">;</span>
  <span class="tok-o">}</span>

  <span class="tok-nd">@Test</span>
  <span class="tok-nd">@FormDeploymentAnnotation</span>
  <span class="tok-kt">void</span> <span class="tok-nf">formUsageExample</span><span class="tok-o">()</span> <span class="tok-o">{</span>
    <span class="tok-n">FormService</span> <span class="tok-n">formService</span> <span class="tok-o">=</span> <span class="tok-n">formEngine</span><span class="tok-o">.</span><span class="tok-na">getFormService</span><span class="tok-o">();</span>

    <span class="tok-n">FormInstance</span> <span class="tok-n">result</span> <span class="tok-o">=</span> <span class="tok-n">formService</span><span class="tok-o">.</span><span class="tok-na">getFormInstanceModelById</span><span class="tok-o">(</span>
        <span class="tok-s">&quot;f7689f79-f1cc-11e6-8549-acde48001122&quot;</span><span class="tok-o">,</span> <span class="tok-kc">null</span><span class="tok-o">);</span>

    <span class="tok-n">Assertions</span><span class="tok-o">.</span><span class="tok-na">assertNotNull</span><span class="tok-o">(</span><span class="tok-n">result</span><span class="tok-o">);</span>
  <span class="tok-o">}</span>
<span class="tok-o">}</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>以下代码片段显示了使用 JUnit 4单元测试和 <code>FlowableFormRule</code> （传递可选的自定义配置）的示例。</p>
</div>
<div class="listingblock">
<div class="title">JUnit 4 test</div>
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17</div></td><td class="code"><span></span><span class="tok-kd">public</span> <span class="tok-kd">class</span> <span class="tok-nc">MyFormDefinitionTest</span> <span class="tok-o">{</span>

  <span class="tok-nd">@Rule</span>
  <span class="tok-kd">public</span> <span class="tok-n">FlowableFormRule</span> <span class="tok-n">flowableFormRule</span> <span class="tok-o">=</span> <span class="tok-k">new</span> <span class="tok-n">FlowableFormRule</span><span class="tok-o">(</span><span class="tok-s">&quot;custom1.flowable.form.cfg.xml&quot;</span><span class="tok-o">);</span>

  <span class="tok-nd">@Test</span>
  <span class="tok-nd">@FormDeploymentAnnotation</span>
  <span class="tok-kd">public</span> <span class="tok-kt">void</span> <span class="tok-nf">formUsageExample</span><span class="tok-o">()</span> <span class="tok-o">{</span>
    <span class="tok-n">FormEngine</span> <span class="tok-n">formEngine</span> <span class="tok-o">=</span> <span class="tok-n">flowableFormRule</span><span class="tok-o">.</span><span class="tok-na">getFormEngine</span><span class="tok-o">();</span>
    <span class="tok-n">FormService</span> <span class="tok-n">formService</span> <span class="tok-o">=</span> <span class="tok-n">dmnEngine</span><span class="tok-o">.</span><span class="tok-na">getFormService</span><span class="tok-o">();</span>

    <span class="tok-n">FormInstance</span> <span class="tok-n">result</span> <span class="tok-o">=</span> <span class="tok-n">formService</span><span class="tok-o">.</span><span class="tok-na">getFormInstanceModelById</span><span class="tok-o">(</span>
        <span class="tok-s">&quot;f7689f79-f1cc-11e6-8549-acde48001122&quot;</span><span class="tok-o">,</span> <span class="tok-kc">null</span><span class="tok-o">);</span>

    <span class="tok-n">Assert</span><span class="tok-o">.</span><span class="tok-na">assertNotNull</span><span class="tok-o">(</span><span class="tok-n">result</span><span class="tok-o">));</span>
  <span class="tok-o">}</span>
<span class="tok-o">}</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="apiFormEngineInWebApp">3.5. Web 应用程序中的表单引擎</h3>
<div class="paragraph">
<p><code>FormEngine</code> 是一个线程安全的类，可以很容易地在多个线程之间共享。在 Web 应用程序中，这意味着可以在容器启动时创建一次表单引擎，并在容器关闭时关闭引擎。</p>
</div>
<div class="paragraph">
<p>以下代码片段显示了如何在普通的 Servlet 环境中编写一个简单的 <code>ServletContextListener</code> 来初始化和销毁表单引擎：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11</div></td><td class="code"><span></span><span class="tok-kd">public</span> <span class="tok-kd">class</span> <span class="tok-nc">FormEnginesServletContextListener</span> <span class="tok-kd">implements</span> <span class="tok-n">ServletContextListener</span> <span class="tok-o">{</span>

  <span class="tok-kd">public</span> <span class="tok-kt">void</span> <span class="tok-nf">contextInitialized</span><span class="tok-o">(</span><span class="tok-n">ServletContextEvent</span> <span class="tok-n">servletContextEvent</span><span class="tok-o">)</span> <span class="tok-o">{</span>
    <span class="tok-n">FormEngines</span><span class="tok-o">.</span><span class="tok-na">init</span><span class="tok-o">();</span>
  <span class="tok-o">}</span>

  <span class="tok-kd">public</span> <span class="tok-kt">void</span> <span class="tok-nf">contextDestroyed</span><span class="tok-o">(</span><span class="tok-n">ServletContextEvent</span> <span class="tok-n">servletContextEvent</span><span class="tok-o">)</span> <span class="tok-o">{</span>
    <span class="tok-n">FormEngines</span><span class="tok-o">.</span><span class="tok-na">destroy</span><span class="tok-o">();</span>
  <span class="tok-o">}</span>

<span class="tok-o">}</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p><code>contextInitialized</code> 方法将委托给 <code>FormEngines.init()</code>。将在类路径中查找 <code>flowable.form.cfg.xml</code> 配置文件，并为给定的配置创建 <code>FormEngine</code> （例如，带有配置文件的多个JAR）。如果类路径上有多个这样的配置文件，请确保它们都有不同的名称。当需要 Form 引擎时，可以使用以下命令获取它：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1</div></td><td class="code"><span></span><span class="tok-n">FormEngines</span><span class="tok-o">.</span><span class="tok-na">getDefaultFormEngine</span><span class="tok-o">()</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>或者</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1</div></td><td class="code"><span></span><span class="tok-n">FormEngines</span><span class="tok-o">.</span><span class="tok-na">getFormEngine</span><span class="tok-o">(</span><span class="tok-s">&quot;myName&quot;</span><span class="tok-o">);</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>当然，也可以如 <a href="#configuration">配置部分</a> 所述，使用创建表单引擎的任何变体。</p>
</div>
<div class="paragraph">
<p>上下文监听器的 <code>contextDestroyed</code> 方法委托给<code>FormEngines.destroy()</code>。这将正确关闭所有初始化的表单引擎。</p>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="springintegration">4. 集成Spring</h2>
<div class="sectionbody">
<div class="paragraph">
<p>虽然你可以在没有Spring的情况下使用Flowable 表单，但我们提供了一些非常好的集成功能，本章将对此进行说明。</p>
</div>
<div class="sect2">
<h3 id="_formenginefactorybean">4.1. FormEngineFactoryBean</h3>
<div class="paragraph">
<p>表单引擎可以按照常规的Spring bean方式进行配置.整合引用到的类是org.flowable.form.spring.FormEngineFactoryBean.该bean持有一个表单引擎配置类并创建表单引擎.这意味着Spring属性的创建和配置与 <a href="#configuration">configuration section</a> 中记录的相同.关于Spring集成和配置引擎bean如下所示</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="xml"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4
5
6
7</div></td><td class="code"><span></span><span class="tok-nt">&lt;bean</span> <span class="tok-na">id=</span><span class="tok-s">&quot;formEngineConfiguration&quot;</span> <span class="tok-na">class=</span><span class="tok-s">&quot;org.flowable.form.spring.SpringFormEngineConfiguration&quot;</span><span class="tok-nt">&gt;</span>
    ...
<span class="tok-nt">&lt;/bean&gt;</span>

<span class="tok-nt">&lt;bean</span> <span class="tok-na">id=</span><span class="tok-s">&quot;formEngine&quot;</span> <span class="tok-na">class=</span><span class="tok-s">&quot;org.flowable.form.spring.FormEngineFactoryBean&quot;</span><span class="tok-nt">&gt;</span>
  <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;formEngineConfiguration&quot;</span> <span class="tok-na">ref=</span><span class="tok-s">&quot;formEngineConfiguration&quot;</span> <span class="tok-nt">/&gt;</span>
<span class="tok-nt">&lt;/bean&gt;</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>注意，formEngineConfiguration bean现在使用的是 <code>org.flowable.form.spring.SpringFormEngineConfiguration</code> 类。</p>
</div>
</div>
<div class="sect2">
<h3 id="_自动部署资源">4.2. 自动部署资源</h3>
<div class="paragraph">
<p>集成Spring还具有部署资源的特性。在配置表单引擎时，您可以指定一组资源.当表单引擎被创建时，将扫描和部署这些资源并过滤防止重复部署。只有资源被更改时，才会将重新部署部署到Flowable 表单数据库.这在经常重启包含大量表单资源的Spring容器中具有很大的意义（例如，测试）</p>
</div>
<div class="paragraph">
<p>例如:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="xml"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4
5
6
7
8
9</div></td><td class="code"><span></span><span class="tok-nt">&lt;bean</span> <span class="tok-na">id=</span><span class="tok-s">&quot;formEngineConfiguration&quot;</span> <span class="tok-na">class=</span><span class="tok-s">&quot;org.flowable.spring.SpringFormEngineConfiguration&quot;</span><span class="tok-nt">&gt;</span>
  ...
  <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;deploymentResources&quot;</span>
    <span class="tok-na">value=</span><span class="tok-s">&quot;classpath*:/org/flowable/spring/test/autodeployment/autodeploy/*.form&quot;</span> <span class="tok-nt">/&gt;</span>
<span class="tok-nt">&lt;/bean&gt;</span>

<span class="tok-nt">&lt;bean</span> <span class="tok-na">id=</span><span class="tok-s">&quot;formEngine&quot;</span> <span class="tok-na">class=</span><span class="tok-s">&quot;org.flowable.form.spring.FormEngineFactoryBean&quot;</span><span class="tok-nt">&gt;</span>
  <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;formEngineConfiguration&quot;</span> <span class="tok-na">ref=</span><span class="tok-s">&quot;formEngineConfiguration&quot;</span> <span class="tok-nt">/&gt;</span>
<span class="tok-nt">&lt;/bean&gt;</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>默认情况下，上面的配置会将匹配过滤后的所有资源进行分组并单独部署到Flowable 表单引擎中,在整个部署过程中重复过滤以防止重新部署未更改的资源.在某些情况下，你可能并不想这么做.例如，如果以这种方式部署一组表单资源，并且这些资源中只有一个表单定义更改了，整个流程定义部署将被视为新的并且被重新部署,尽管实际上只改变了一个但是每个表单都被定义为了新的版本,
为了能够自定义部署的方式，您可以在 <code>SpringFormEngineConfiguration</code> 中，指定 <code>deploymentMode</code> 属性。该属性定义了从过滤器匹配的资源集合以及确定部署的方式。默认情况下，该属性提供3个默认属性：</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>default</code>: 将所有资源分组到单个部署中，并对该部署应用重复过滤。如果您未指定其他值，将默认使用它。</p>
</li>
<li>
<p><code>single-resource</code>: 为每个单独的资源单独部署，并对该部署应用重复过滤。适用于单独部署某个已更改表单定义的资源，仅创建该表单定义的新版本。</p>
</li>
<li>
<p><code>resource-parent-folder</code>: 为共享同一父文件夹的资源创建单独的部署，并对该部署应用重复过滤。适用于为大多数资源创建单独的部署，但仍可以通过将它们放在共享文件夹中来对其进行分组。以下是为 <code>deploymentMode</code> 属性指定 <code>single-resource</code> 配置的示例：</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="xml"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4
5
6</div></td><td class="code"><span></span><span class="tok-nt">&lt;bean</span> <span class="tok-na">id=</span><span class="tok-s">&quot;formEngineConfiguration&quot;</span>
    <span class="tok-na">class=</span><span class="tok-s">&quot;org.flowable.form.spring.SpringFormEngineConfiguration&quot;</span><span class="tok-nt">&gt;</span>
  ...
  <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;deploymentResources&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;classpath*:/flowable/*.form&quot;</span> <span class="tok-nt">/&gt;</span>
  <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;deploymentMode&quot;</span> <span class="tok-na">value=</span><span class="tok-s">&quot;single-resource&quot;</span> <span class="tok-nt">/&gt;</span>
<span class="tok-nt">&lt;/bean&gt;</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>除了使用上面列出的 <code>deploymentMode</code> 属性之外，您还可以自定义属性来实现部署。如果需要，您可以创建 <code>SpringFormEngineConfiguration</code> 的子类并重写+getAutoDeploymentStrategy（String deploymentMode）+ 方法。该法确定将哪个部署策略用于 <code>deploymentMode</code> 配置的特定值。</p>
</div>
</div>
<div class="sect2">
<h3 id="springUnitTest">4.3. 单元测试</h3>
<div class="paragraph">
<p>与Spring集成时，使用标准的<a href="#apiUnitTesting">Flowable testing facilities</a>来测试表单将会变得非常简单.
以下示例展示了如何在基于Spring的JUnit 4和5测试中测试表单：</p>
</div>
<div class="listingblock">
<div class="title">JUnit 5 测试</div>
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20</div></td><td class="code"><span></span><span class="tok-nd">@ExtendWith</span><span class="tok-o">(</span><span class="tok-n">FlowableFormSpringExtension</span><span class="tok-o">.</span><span class="tok-na">class</span><span class="tok-o">)</span>
<span class="tok-nd">@ExtendWith</span><span class="tok-o">(</span><span class="tok-n">SpringExtension</span><span class="tok-o">.</span><span class="tok-na">class</span><span class="tok-o">)</span>
<span class="tok-nd">@ContextConfiguration</span><span class="tok-o">(</span><span class="tok-n">classes</span> <span class="tok-o">=</span> <span class="tok-n">SpringJunitJupiterTest</span><span class="tok-o">.</span><span class="tok-na">TestConfiguration</span><span class="tok-o">.</span><span class="tok-na">class</span><span class="tok-o">)</span>
<span class="tok-kd">public</span> <span class="tok-kd">class</span> <span class="tok-nc">SpringJunit4Test</span> <span class="tok-o">{</span>

    <span class="tok-nd">@Autowired</span>
    <span class="tok-kd">private</span> <span class="tok-n">FormEngine</span> <span class="tok-n">formEngine</span><span class="tok-o">;</span>

    <span class="tok-nd">@Autowired</span>
    <span class="tok-kd">private</span> <span class="tok-n">FormService</span> <span class="tok-n">formService</span><span class="tok-o">;</span>

    <span class="tok-nd">@Test</span>
    <span class="tok-nd">@FormDeploymentAnnotation</span>
    <span class="tok-kd">public</span> <span class="tok-kt">void</span> <span class="tok-nf">simpleFormInstanceTest</span><span class="tok-o">()</span> <span class="tok-o">{</span>
        <span class="tok-n">FormInstance</span> <span class="tok-n">result</span> <span class="tok-o">=</span> <span class="tok-n">formService</span><span class="tok-o">.</span><span class="tok-na">getFormInstanceModelById</span><span class="tok-o">(</span>
            <span class="tok-s">&quot;f7689f79-f1cc-11e6-8549-acde48001122&quot;</span><span class="tok-o">,</span> <span class="tok-kc">null</span><span class="tok-o">);</span>

        <span class="tok-n">Assertions</span><span class="tok-o">.</span><span class="tok-na">assertNotNull</span><span class="tok-o">(</span><span class="tok-n">result</span><span class="tok-o">));</span>
    <span class="tok-o">}</span>
<span class="tok-o">}</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>使用 <code>FlowableFormSpringExtension</code> 时允许使用 <code>Deployment</code> 注解。</p>
</div>
<div class="listingblock">
<div class="title">JUnit 4 测试</div>
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23</div></td><td class="code"><span></span><span class="tok-nd">@RunWith</span><span class="tok-o">(</span><span class="tok-n">SpringJUnit4ClassRunner</span><span class="tok-o">.</span><span class="tok-na">class</span><span class="tok-o">)</span>
<span class="tok-nd">@ContextConfiguration</span><span class="tok-o">(</span><span class="tok-s">&quot;classpath:org/flowable/spring/test/junit4/springTypicalUsageTest-context.xml&quot;</span><span class="tok-o">)</span>
<span class="tok-kd">public</span> <span class="tok-kd">class</span> <span class="tok-nc">SpringJunit4Test</span> <span class="tok-o">{</span>

    <span class="tok-nd">@Autowired</span>
    <span class="tok-kd">private</span> <span class="tok-n">FormEngine</span> <span class="tok-n">formEngine</span><span class="tok-o">;</span>

    <span class="tok-nd">@Autowired</span>
    <span class="tok-kd">private</span> <span class="tok-n">FormService</span> <span class="tok-n">formService</span><span class="tok-o">;</span>

    <span class="tok-nd">@Autowired</span>
    <span class="tok-nd">@Rule</span>
    <span class="tok-kd">public</span> <span class="tok-n">FlowableFormRule</span> <span class="tok-n">flowableSpringRule</span><span class="tok-o">;</span>

    <span class="tok-nd">@Test</span>
    <span class="tok-nd">@FormDeploymentAnnotation</span>
    <span class="tok-kd">public</span> <span class="tok-kt">void</span> <span class="tok-nf">simpleFormInstanceTest</span><span class="tok-o">()</span> <span class="tok-o">{</span>
        <span class="tok-n">FormInstance</span> <span class="tok-n">result</span> <span class="tok-o">=</span> <span class="tok-n">formService</span><span class="tok-o">.</span><span class="tok-na">getFormInstanceModelById</span><span class="tok-o">(</span>
            <span class="tok-s">&quot;f7689f79-f1cc-11e6-8549-acde48001122&quot;</span><span class="tok-o">,</span> <span class="tok-kc">null</span><span class="tok-o">);</span>

        <span class="tok-n">Assert</span><span class="tok-o">.</span><span class="tok-na">assertNotNull</span><span class="tok-o">(</span><span class="tok-n">result</span><span class="tok-o">));</span>
    <span class="tok-o">}</span>
<span class="tok-o">}</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>注意，在测试时，您需要在Spring配置中定义 <em>org.flowable.form.engine.test.FlowableFormRule</em> bean（在上面的示例中通过自动装配注入）。</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="xml"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3</div></td><td class="code"><span></span><span class="tok-nt">&lt;bean</span> <span class="tok-na">id=</span><span class="tok-s">&quot;flowableFormRule&quot;</span> <span class="tok-na">class=</span><span class="tok-s">&quot;org.flowable.form.engine.test.FlowableFormRule&quot;</span><span class="tok-nt">&gt;</span>
    <span class="tok-nt">&lt;property</span> <span class="tok-na">name=</span><span class="tok-s">&quot;formEngine&quot;</span> <span class="tok-na">ref=</span><span class="tok-s">&quot;formEngine&quot;</span><span class="tok-nt">/&gt;</span>
<span class="tok-nt">&lt;/bean&gt;</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="chDeployment">5. 部署</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_表单定义">5.1. 表单定义</h3>
<div class="paragraph">
<p><strong>表单定义</strong>带有<code>.form</code>后缀名，可以被部署到<strong>表单引擎</strong>。</p>
</div>
<div class="paragraph">
<p>当<strong>表单引擎</strong>接入<strong>流程引擎</strong>后，<strong>表单定义</strong>和与此流程相关其他资源，将被打包进一个业务存档(BAR, Business archive)中。若使用了 flowable-form-engine-configurator 或 flowable-form-spring-configurator 模块，<strong>流程引擎</strong>部署服务将负责把表单资源部署到<strong>流程引擎</strong>中。</p>
</div>
<div class="sect3">
<h4 id="_表单定义_2">5.1.1. 表单定义</h4>
<div class="paragraph">
<p>每个<strong>表单定义</strong>由一个或多个表单字段定义组成。当部署一个<strong>表单定义</strong>时，其信息将会被插入到 ACT_FO_FORM_DEFINITION 表中。</p>
</div>
</div>
<div class="sect3">
<h4 id="_编程方式部署">5.1.2. 编程方式部署</h4>
<div class="paragraph">
<p>可使用如下方式部署一个<strong>表单定义</strong>：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4
5
6
7</div></td><td class="code"><span></span><span class="tok-n">String</span> <span class="tok-n">formDefinition</span> <span class="tok-o">=</span> <span class="tok-s">&quot;path/to/definition-one.form&quot;</span><span class="tok-o">;</span>
<span class="tok-n">ZipInputStream</span> <span class="tok-n">inputStream</span> <span class="tok-o">=</span> <span class="tok-k">new</span> <span class="tok-n">ZipInputStream</span><span class="tok-o">(</span><span class="tok-k">new</span> <span class="tok-n">FileInputStream</span><span class="tok-o">(</span><span class="tok-n">barFileName</span><span class="tok-o">));</span>

<span class="tok-n">formRepositoryService</span><span class="tok-o">.</span><span class="tok-na">createDeployment</span><span class="tok-o">()</span>
    <span class="tok-o">.</span><span class="tok-na">name</span><span class="tok-o">(</span><span class="tok-s">&quot;definition-one&quot;</span><span class="tok-o">)</span>
    <span class="tok-o">.</span><span class="tok-na">addClasspathResource</span><span class="tok-o">(</span><span class="tok-n">formDefinition</span><span class="tok-o">)</span>
    <span class="tok-o">.</span><span class="tok-na">deploy</span><span class="tok-o">();</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="versioningOfFormDefinitions">5.2. 表单定义的版本管理</h3>
<div class="paragraph">
<p><strong>表单定义</strong>的版本会在部署期间创建，Flowable在将<strong>表单定义</strong>存储到表单数据库前，为其分配一个版本。</p>
</div>
<div class="paragraph">
<p>对于每个<strong>表单定义</strong>，执行以下步骤来初始化这些属性<code>key</code>、<code>version</code>、 <code>name</code>和<code>id</code>：</p>
</div>
<div class="ulist">
<ul>
<li>
<p>表单定义JSON文件中的<code>key</code>属性，被用作数据库中表单定义信息表的<code>key</code>属性。</p>
</li>
<li>
<p>表单定义JSON文件中的<code>name</code>属性，被用作数据库中表单定义信息表的<code>name</code>属性。</p>
</li>
<li>
<p>当首次以一个特定的<code>key</code>属性部署表单定义时，将分配版本为1。对于具有相同<code>key</code>属性表单定义的所有后续部署，版本将设置为当前已部署的最大版本号加1。<code>key</code>属性用来区分不同的表单定义。</p>
</li>
<li>
<p><code>id</code>属性是一个唯一的编号，用以保证在集群环境下，流程定义缓存中，流程<code>id</code>的唯一性。</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>表单定义示例如下：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13</div></td><td class="code"><span></span><span class="tok-p">{</span>
    <span class="tok-nt">&quot;key&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;form1&quot;</span><span class="tok-p">,</span>
    <span class="tok-nt">&quot;name&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;My first form&quot;</span><span class="tok-p">,</span>
    <span class="tok-nt">&quot;fields&quot;</span><span class="tok-p">:</span> <span class="tok-p">[</span>
        <span class="tok-p">{</span>
            <span class="tok-nt">&quot;id&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;input1&quot;</span><span class="tok-p">,</span>
            <span class="tok-nt">&quot;name&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;Input1&quot;</span><span class="tok-p">,</span>
            <span class="tok-nt">&quot;type&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;text&quot;</span><span class="tok-p">,</span>
            <span class="tok-nt">&quot;required&quot;</span><span class="tok-p">:</span> <span class="tok-kc">false</span><span class="tok-p">,</span>
            <span class="tok-nt">&quot;placeholder&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;empty&quot;</span>
        <span class="tok-p">}</span>
    <span class="tok-p">]</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>当部署此表单定义后，数据库中表单定义信息表将如下所示：</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">id</th>
<th class="tableblock halign-left valign-top">key</th>
<th class="tableblock halign-left valign-top">name</th>
<th class="tableblock halign-left valign-top">version</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">e29d4126-ed4d-11e6-9e00-7282cbd6ce64</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">form1</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">My first form</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">1</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>假设我们现在部署相同表单定义的一个更新版本（例如，更改文本变量），但表单定义的<code>key</code>属性保持不变。数据库中表单定义信息表将包含以下条目：</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">id</th>
<th class="tableblock halign-left valign-top">key</th>
<th class="tableblock halign-left valign-top">name</th>
<th class="tableblock halign-left valign-top">version</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">e29d4126-ed4d-11e6-9e00-7282cbd6ce64</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">form1</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">My first form</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">1</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">e9c2a6c0-c085-11e6-9096-6ab56fad108a</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">form1</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">My first form</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">2</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>如果我们创建第二个表单定义，如下所示，并将其部署到Flowable<strong>表单引擎</strong>，第三行将会添加到表中。</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="xml"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13</div></td><td class="code"><span></span>{
    &quot;key&quot;: &quot;form2&quot;,
    &quot;name&quot;: &quot;My second form&quot;,
    &quot;fields&quot;: [
        {
            &quot;id&quot;: &quot;input2&quot;,
            &quot;name&quot;: &quot;Input2&quot;,
            &quot;type&quot;: &quot;text&quot;,
            &quot;required&quot;: false,
            &quot;placeholder&quot;: &quot;empty&quot;
        }
    ]
}
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>数据库中表单定义信息表将如下所示：</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">id</th>
<th class="tableblock halign-left valign-top">key</th>
<th class="tableblock halign-left valign-top">name</th>
<th class="tableblock halign-left valign-top">version</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">e29d4126-ed4d-11e6-9e00-7282cbd6ce64</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">form1</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">My first form</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">1</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">e9c2a6c0-c085-11e6-9096-6ab56fad108a</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">form1</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">My first form</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">2</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">d317d3f7-e948-11e6-9ce6-b28c070b517d</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">form2</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">My second form</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">1</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>请注意新表单定义的<code>key</code>属性与第一个表单定义不同。 Flowable<strong>表单引擎</strong>仅使用<code>key</code>属性区分表单定义。因此，新的表单定义部署版本为1。</p>
</div>
</div>
<div class="sect2">
<h3 id="deploymentCategory">5.3. 类别</h3>
<div class="paragraph">
<p><strong>表单部署</strong>和<strong>表单定义</strong>都可以具有用户定义的类别。
部署类别可以在如下API中指定：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4
5</div></td><td class="code"><span></span><span class="tok-n">formRepository</span>
    <span class="tok-o">.</span><span class="tok-na">createDeployment</span><span class="tok-o">()</span>
    <span class="tok-o">.</span><span class="tok-na">category</span><span class="tok-o">(</span><span class="tok-s">&quot;yourCategory&quot;</span><span class="tok-o">)</span>
    <span class="tok-o">...</span>
    <span class="tok-o">.</span><span class="tok-na">deploy</span><span class="tok-o">();</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>表单定义类别可以在如下API中指定:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="java"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1</div></td><td class="code"><span></span><span class="tok-n">formRepository</span><span class="tok-o">.</span><span class="tok-na">setFormDefinitionCategory</span><span class="tok-o">(</span><span class="tok-s">&quot;e9c2a6c0-c085-11e6-9096-6ab56fad108a&quot;</span><span class="tok-o">,</span> <span class="tok-s">&quot;yourCategory&quot;</span><span class="tok-o">);</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="formIntroduction">6. 表单介绍</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="whatIsFormDefinition">6.1. 表单定义是什么？</h3>
<div class="paragraph">
<p>对于BPMN引擎而言，我们沿用了BPMN规范，同理对与DMN引擎，我们使用了DMN规范。但是对于开始或任务表单，并不存在类似的共性问题让我们使用。因此，我们自己定义了一个基于JSON格式的的表单结构定义，我们使用这种结构作为Flowable表单编辑器的输出格式，而且我们会在Flowable任务应用中提取该结构让开始或任务表单使用。</p>
</div>
</div>
<div class="sect2">
<h3 id="formDefining">6.2. Defining a form</h3>
<div class="paragraph">
<p>用你最爱的文本或JSON编辑器新建一个JSON文件，然后给这个文件起个个性的名字。确保这个文件的后缀为.form，比如shareniu.fom,否则表单引擎将无法部署此文件。</p>
</div>
<div class="paragraph">
<p>表单的JSON定义以key、name和description开头。表单引擎通过属性key来辨别表单在整个表单引擎中的唯一身份。对于来源相同的同一个表单定义的版本系统也是基于属性key运作的。第二部分是一个数组类型fields，表单定义的字段在这里阐明。第三部分是可选的，用来定义表单的结果outcomes。示例如下：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23</div></td><td class="code"><span></span><span class="tok-p">{</span>
    <span class="tok-nt">&quot;key&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;form1&quot;</span><span class="tok-p">,</span>
    <span class="tok-nt">&quot;name&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;My first form&quot;</span><span class="tok-p">,</span>
    <span class="tok-nt">&quot;fields&quot;</span><span class="tok-p">:</span> <span class="tok-p">[</span>
        <span class="tok-p">{</span>
            <span class="tok-nt">&quot;id&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;input1&quot;</span><span class="tok-p">,</span>
            <span class="tok-nt">&quot;name&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;Input1&quot;</span><span class="tok-p">,</span>
            <span class="tok-nt">&quot;type&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;text&quot;</span><span class="tok-p">,</span>
            <span class="tok-nt">&quot;required&quot;</span><span class="tok-p">:</span> <span class="tok-kc">false</span><span class="tok-p">,</span>
            <span class="tok-nt">&quot;placeholder&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;empty&quot;</span>
        <span class="tok-p">}</span>
    <span class="tok-p">],</span>
    <span class="tok-nt">&quot;outcomes&quot;</span><span class="tok-p">:</span> <span class="tok-p">[</span>
        <span class="tok-p">{</span>
            <span class="tok-nt">&quot;id&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;null&quot;</span><span class="tok-p">,</span>
            <span class="tok-nt">&quot;name&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;Accept&quot;</span>
        <span class="tok-p">},</span>
        <span class="tok-p">{</span>
            <span class="tok-nt">&quot;id&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;null&quot;</span><span class="tok-p">,</span>
            <span class="tok-nt">&quot;name&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;Reject&quot;</span>
        <span class="tok-p">}</span>
    <span class="tok-p">]</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>每个表单字段都有一个id、name和type属性。在同一个表单定义中id应该是独一无二的。当一个用户完成表单后id还能当作变量名使用。在这个小例子中，一个名叫input1的流程变量被创建了，用户填入这个文本字段里的东西就是这个变量的值。结果outcomes也可以被映射成一个变量，此变量基于表单标识符，格式为："form_&lt;form-identifier&gt;_outcome"。举例说明，选中的结果会被设置为一个名叫"form_form1_outcome"的变量。你可以通过表达式${form_form1_outcome == "Accept"}来检验结果outcome是否为&#8217;Accept'</p>
</div>
<div class="paragraph">
<p>表单支持以下类型字段</p>
</div>
<div class="ulist">
<ul>
<li>
<p>text: 文本字段</p>
</li>
<li>
<p>multi-line-text: 多行文本字段</p>
</li>
<li>
<p>integer: 文本字段，但是只允许数字类型的值</p>
</li>
<li>
<p>boolean: 复选框字段</p>
</li>
<li>
<p>date: 日期字段</p>
</li>
<li>
<p>dropdown: 选择框字段，定义字段时可以设置选项的值</p>
</li>
<li>
<p>radio-buttons: 单选字段，定义字段时可以设置选项的值</p>
</li>
<li>
<p>people: 选择框字段，可以选中用户表里的一个用户</p>
</li>
<li>
<p>functional-group: 选择框字段，可以选中分组表里的一个组</p>
</li>
<li>
<p>upload: 上传文件字段</p>
</li>
<li>
<p>expression:  一个标签，在标签文本中你可以运用JUEL表达式操作变量或其他动态的值</p>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="restApiChapter">7. REST API</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_general_flowable_rest_principles">7.1. Flowable REST一般原则</h3>
<div class="sect3">
<h4 id="_installation_and_authentication">7.1.1. 安装与认证</h4>
<div class="paragraph">
<p>Flowable为Flowable引擎提供了REST API，可以通过在servlet容器（如Apache Tomcat）中部署flowable-rest.war文件来安装。另外，也可以通过在应用中引入servlet（包括对应的映射），并将所有flowable-rest的依赖加入classpath的方式使用。</p>
</div>
<div class="paragraph">
<p>默认情况下Flowable引擎会连接至一个H2内存数据库。可以通过<em>WEB-INF/META-INF/flowable-app</em>文件夹下的flowable-app.properties文件修改数据库设置。REST API使用JSON格式( <a href="http://www.json.org" class="bare">http://www.json.org</a> )，并基于Spring MVC( <a href="http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html" class="bare">http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html</a> )构建。</p>
</div>
<div class="paragraph">
<p>默认情况下访问任何REST资源都需要具有<em>rest-access-api</em>权限的合法用户。如果需要任何合法用户都可以访问REST API，可以将<em>flowable.rest.app.authentication-mode</em>设置为<em>any-user</em>（这也是之前版本Flowable的默认设置）。</p>
</div>
<div class="paragraph">
<p>通过如下参数设置可以访问REST API的默认用户：</p>
</div>
<div class="listingblock">
<div class="content">
<pre>flowable.rest.app.admin.user-id=rest-admin
flowable.rest.app.admin.password=test
flowable.rest.app.admin.first-name=Rest
flowable.rest.app.admin.last-name=Admin</pre>
</div>
</div>
<div class="paragraph">
<p>当REST应用启动时，如果用户不存在或无法找到，则会创建该用户。这个用户会被赋予访问REST API所需的<em>access-rest-api</em>权限。<strong>请不要忘记修改这个用户的密码</strong>。如果未设置<em>flowable.rest.app.admin.user-id</em>，则不会创建用户或权限。也因为此，在初始化完成后删除这些参数，并不会删除之前已经配置的用户或权限。</p>
</div>
<div class="paragraph">
<p>使用基础HTTP访问认证，因此在请求时，需要在HTTP-header中添加 <em>Authorization: Basic &#8230;&#8203;==</em> 。也可以在请求url中包含用户名与密码（如 <em><a href="http://username:password@localhost:8080/xyz" class="bare">http://username:password@localhost:8080/xyz</a></em>）。</p>
</div>
<div class="paragraph">
<p><strong>建议使用基础认证时，同时使用HTTPS。</strong></p>
</div>
</div>
<div class="sect3">
<h4 id="_configuration_2">7.1.2. 配置</h4>
<div class="paragraph">
<p>Flowable REST web应用使用Spring Java Configuration来启动Flowable引擎，使用Spring security定义基础认证安全，并为为特定的变量处理定义了变量转换。
有少量参数可以通过修改WEB-INF/classes文件夹下的engine.properties文件定义。
如果需要高级配置选项，可以在flowable-custom-context.xml文件中覆盖默认的Spring bean，这个文件也在WEB-INF/classes文件夹下。
该文件中已经以注释形式提供了示例配置。也可以在该文件中定义一个新的命名为restResponsefactory的Spring bean，覆盖默认的RestResponseFactory，并使用自定义实现类。</p>
</div>
</div>
<div class="sect3">
<h4 id="restUsageInTomcat">7.1.3. 在Tomcat中使用</h4>
<div class="paragraph">
<p>由于<a href="http://tomcat.apache.org/tomcat-8.0-doc/security-howto.html">Tomcat中的默认安全参数</a>，<strong>默认不能使用转义斜线符（<code>%2F</code>与<code>%5C</code>）（将返回400）。</strong>这可能会影响部署资源与其数据URL，因为URL可能包含转义斜线符。</p>
</div>
<div class="paragraph">
<p>当发现400异常结果时，可以设置下列系统参数:</p>
</div>
<div class="paragraph">
<p><em>-Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true</em></p>
</div>
<div class="paragraph">
<p>最佳实践是（在post/put JSON时），在下面介绍的HTTP请求中，永远将<strong>Accept</strong>与<strong>Content-Type</strong>HTTP头设置为<strong>application/json</strong>。</p>
</div>
</div>
<div class="sect3">
<h4 id="_methods_and_return_codes">7.1.4. 方法与返回码</h4>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 1. HTTP方法与对应操作</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">方法</th>
<th class="tableblock halign-left valign-top">操作</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>GET</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">获取单个资源，或获取一组资源。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>POST</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">创建一个新资源。在查询结构太复杂，不能放入GET请求的查询URL中时，也用于执行资源查询。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>PUT</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">更新一个已有资源的参数。也用于调用已有资源提供的操作。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>DELETE</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">删除一个已有资源。</p></td>
</tr>
</tbody>
</table>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 2. HTTP方法响应码</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">响应</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>200 - Ok</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">操作成功，返回响应（<code>GET</code>与<code>PUT</code>请求）。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>201 - 已创建</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">操作成功，已经创建了实体，并在响应体中返回（<code>POST</code>请求）。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>204 - 无内容</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">操作成功，已经删除了实体，因此没有返回的响应体（<code>DELETE</code>请求）。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>401 - 未认证</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">操作失败。操作要求设置认证头。如果请求中有认证头，则提供的鉴证并不合法，或者用户未被授权进行该操作。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>403 - 禁止</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">操作被禁止，且不应重试。这不是鉴证或授权的问题，而是说明不允许该操作。例如：无论任何用户或流程/任务的状态，删除一个运行中流程的任务是且永远是不允许的。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>404 - 未找到</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">操作失败。请求的资源未找到。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>405 - 不允许的方法</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">操作失败。使用的方法不能用于该资源。例如，更新（PUT）部署资源将返回<code>405</code>响应码。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>409 - 冲突</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">操作失败。该操作导致更新一个已被其他操作更新的资源，因此本更新不再有效。也可以表示正在为一个集合创建一个资源，但该标识符已存在。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>415 - 不支持的媒体类型</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">操作失败。请求提包含了不支持的媒体类型。也会发生在请求体JSON中包含了未知的属性或值，但没有可用的格式/类型来处理的情况。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>500 - 服务器内部错误</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">操作失败。执行操作时发生了未知异常。响应体中包含了错误的细节。</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>HTTP响应的media-type总是<code>application/json</code>，除非请求的是二进制内容（例如部署资源数据）。这时将使用内容的media-type。</p>
</div>
</div>
<div class="sect3">
<h4 id="_error_response_body">7.1.5. 错误响应体</h4>
<div class="paragraph">
<p>当发生错误时（可能是客户端或服务器端的错误，4XX及5XX状态码），响应体会包含一个描述了发生的错误的对象。任务未找到时的404状态的例子：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4</div></td><td class="code"><span></span><span class="tok-p">{</span>
  <span class="tok-nt">&quot;statusCode&quot;</span> <span class="tok-p">:</span> <span class="tok-mi">404</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;errorMessage&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;Could not find a task with id &#39;444&#39;.&quot;</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_request_parameters">7.1.6. 请求参数</h4>
<div class="sect4">
<h5 id="_url_fragments">URL片段</h5>
<div class="paragraph">
<p>作为url的一部分的参数（例如，<code><a href="http://host/flowable-rest/service/repository/deployments/{deploymentId}" class="bare">http://host/flowable-rest/service/repository/deployments/{deploymentId}</a></code>中的deploymentId参数），如果包含特殊字符，则需要进行合适的转义（参见<a href="https://en.wikipedia.org/wiki/Percent-encoding">URL编码或百分号编码</a>）。大多数框架都内建了这个功能，但要记得考虑它。特别是对可能包含斜线符的段落（例如部署资源），就必须要做转义。</p>
</div>
</div>
<div class="sect4">
<h5 id="_rest_url_query_parameters">Rest URL查询参数</h5>
<div class="paragraph">
<p>作为查询字符串添加在URL中的参数（例如<code><a href="http://host/flowable-rest/service/deployments?name=Deployment" class="bare">http://host/flowable-rest/service/deployments?name=Deployment</a></code>中的name参数）可以使用下列类型。在相应的REST-API文档中也会提到：</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 3. URL查询参数类型</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">类型</th>
<th class="tableblock halign-left valign-top">格式</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">String</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">纯文本参数。可以包含任何URL允许的合法字符。对于<code>XXXLike</code>参数，字符串可能会包含通配符<code>%</code>（需要进行URL编码）。可以进行like搜索，例如，'Tas%'将匹配所有以&#8217;Tas&#8217;开头的值。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Integer</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">整形参数。只能包含数字型非小数值，在-2.147.483.648至2.147.483.647之间。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Long</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">长整形参数。只能包含数字型非小数值，在-9.223.372.036.854.775.808至9.223.372.036.854.775.807之间。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean型参数。可以为<code>true</code>或<code>false</code>。任何其他值都会导致'<code>405 - 错误请求</code>'响应码。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Date</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">日期型参数。使用ISO-8601日期格式（参考<a href="http://en.wikipedia.org/wiki/ISO_8601">wikipedia中的ISO-8601</a>），使用时间与日期部分（例如<code>2013-04-03T23:45Z</code>）。</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect4">
<h5 id="restJsonBody">JSON body 参数</h5>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 4. JSON参数类型</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">类型</th>
<th class="tableblock halign-left valign-top">格式</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">String</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">纯文本参数。对于<code>XXXLike</code>参数，字符串可能会包含通配符<code>%</code>。可以进行like搜索。例如，'Tas%'将匹配所有以&#8217;Tas&#8217;开头的值。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Integer</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">整形参数，使用JSON数字。只能包含数字型非小数值，在-2.147.483.648至2.147.483.647之间。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Long</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">长整形参数，使用JSON数字。只能包含数字型非小数值，在-9.223.372.036.854.775.808至9.223.372.036.854.775.807之间。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Date</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">日期型参数，使用JSON文本。使用ISO-8601日期格式（参考<a href="http://en.wikipedia.org/wiki/ISO_8601">wikipedia中的ISO-8601</a>），使用时间与日期组分（例如<code>2013-04-03T23:45Z</code>）。</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect4">
<h5 id="restPagingAndSort">分页与排序</h5>
<div class="paragraph">
<p>分页与排序参数可以作为查询字符串加入URL中（例如<code><a href="http://host/flowable-rest/service/deployments?sort=name" class="bare">http://host/flowable-rest/service/deployments?sort=name</a></code>中的name参数）。</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 5. JSON查询变量参数</caption>
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">参数</th>
<th class="tableblock halign-left valign-top">默认值</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">sort</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">各查询实现不同</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">排序键的名字，在各查询实现中默认值与可用值都不同。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">order</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">asc</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">排序顺序，可以是&#8217;asc'（顺序）或&#8217;desc'（逆序）。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">start</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">0</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">对结果分页的参数。默认结果从0开始。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">size</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">10</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">对结果分页的参数。默认大小为10.</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect4">
<h5 id="restQueryVariable">JSON查询变量格式</h5>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4
5
6
7</div></td><td class="code"><span></span>
<span class="tok-p">{</span>
  <span class="tok-nt">&quot;name&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;variableName&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;value&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;variableValue&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;operation&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;equals&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;type&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;string&quot;</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 6. JSON查询变量参数</caption>
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">参数</th>
<th class="tableblock halign-left valign-top">必填</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">包含在查询中的变量名。在有些使用'<code>equals</code>'的查询中可以为空，查询<strong>任意变量名</strong>为给定值的资源。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">value</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">是</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">包含在查询中的变量值，需要使用给定类型的正确格式。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">operator</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">是</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">查询使用的操作，可以为下列值：<code>equals, notEquals, equalsIgnoreCase, notEqualsIgnoreCase, lessThan, greaterThan, lessThanOrEquals, greaterThanOrEquals</code>与<code>like</code>。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">type</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">所用变量的类型。当省略时，会从<code>value</code>参数推理类型。任何JSON文本值都使用是<code>string</code>类型，JSON boolean值使用<code>boolean</code>类型，JSON数字使用<code>long</code>或<code>integer</code>，取决于数字的大小。建议在有疑惑时明确指定类型。其他支持的类型列在下面。</p></td>
</tr>
</tbody>
</table>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 7. 默认查询JSON类型</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">类型名</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">值处理转换为<code>java.lang.String</code>。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">short</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">值处理转换为<code>java.lang.Integer</code>。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">值处理转换为<code>java.lang.Integer</code>。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">long</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">值处理转换为<code>java.lang.Long</code>。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">double</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">值处理转换为<code>java.lang.Double</code>。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">值处理转换为<code>java.lang.Boolean</code>。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">date</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">值处理转换为<code>java.util.Date</code>。JSON字符串将使用ISO-8601日期格式转换。</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect4">
<h5 id="restVariables">变量表示</h5>
<div class="paragraph">
<p>读取与写入变量（执行选择）时，REST API都使用通用原则与JSON格式。变量的JSON表示为：</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4
5
6</div></td><td class="code"><span></span><span class="tok-p">{</span>
  <span class="tok-nt">&quot;name&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;variableName&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;value&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;variableValue&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;valueUrl&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;http://...&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;type&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;string&quot;</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 8. 变量的JSON属性</caption>
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">参数</th>
<th class="tableblock halign-left valign-top">必填</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">是</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">变量名。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">value</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">变量的值。当写入变量且省略了<code>value</code>时，会使用<code>null</code>作为value。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">valueUrl</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">当读取<code>binary</code>或<code>serializable</code>类型的变量时，这个属性将指向可用于获取原始二进制数据的URL。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">type</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">变量的类型。查看下面的表格了解类型的更多信息。当写入变量且省略了这个值时，将使用请求的原始JSON属性类型推断，限制在<code>string</code>, <code>double</code>, <code>integer</code>与<code>boolean</code>中。建议总是包含类型，以确保不会错误推断类型。</p></td>
</tr>
</tbody>
</table>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 9. 变量类型</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">类型名</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">值按照<code>java.lang.String</code>处理。写入变量时使用原始JSON文本。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">integer</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">值按照<code>java.lang.Integer</code>处理。按约定写入变量时使用JSON数字，失败则退回JSON文本。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">short</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">值按照<code>java.lang.Short</code>处理。按约定写入变量时使用JSON数字，失败则退回JSON文本。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">long</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">值按照<code>java.lang.Long</code>处理。按约定写入变量时使用JSON数字，失败则退回JSON文本。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">double</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">值按照<code>java.lang.Double</code>处理。按约定写入变量时使用JSON数字，失败则退回JSON文本。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">值按照<code>java.lang.Boolean</code>处理。按约定写入变量时使用JSON boolean。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">date</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">值按照<code>java.util.Date</code>处理。写入变量时将转换为ISO-8601日期格式。</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>可以使用自定义JSON表示，以支持额外的变量类型（既可以是简单值，也可以是复杂/嵌套的JSON对象）。通过扩展<code>org.flowable.rest.service.api.RestResponseFactory</code>的<code>initializeVariableConverters()</code>方法，可以添加额外的<code>org.flowable.rest.service.api.engine.variable.RestVariableConverter</code>类，用于将POJO转换为适合通过REST传输的格式，以及将REST值转换为POJO。实际转换JSON使用Jackson。</p>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_部署">7.2. 部署</h3>
<div class="paragraph">
<p><strong>当使用tomcat时, 请参考在<a href="#restTomcat">Tomcat</a>中的用法。</strong></p>
</div>
<div class="sect3">
<h4 id="_部署列表">7.2.1. 部署列表</h4>
<div class="listingblock">
<div class="content">
<pre>GET form-repository/deployments</pre>
</div>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 10. URL查询参数</caption>
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">参数名称</th>
<th class="tableblock halign-left valign-top">是否必须</th>
<th class="tableblock halign-left valign-top">参数类型</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回根据名称查询返回的部署结果集.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">name模糊查询</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回根据名称模糊匹配的部署结果集.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">category</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回符合类别的部署结果集.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">不等于category</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回不等于该类别的其他部署结果集.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">tenantId</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回给符合租户ID的部署结果集.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">模糊匹配tenantId值</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回模糊匹配到租户ID值的部署结果集.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">withoutTenantId</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">布尔</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">如果为 true 则仅返回未设置tenantId的部署。如果为 false 则忽略参数租户ID。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">sort</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>id</em> (默认), <em>名称</em>, <em>部署时间</em> or <em>租户ID</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">要排序的属性要与 <em>order</em> 一起使用.</p></td>
</tr>
</tbody>
</table>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 11. REST 响应编码</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">响应编码</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示请求成功.</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p><strong>成功响应正文:</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17</div></td><td class="code"><span></span><span class="tok-p">{</span>
  <span class="tok-nt">&quot;data&quot;</span><span class="tok-p">:</span> <span class="tok-p">[</span>
    <span class="tok-p">{</span>
      <span class="tok-nt">&quot;id&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;10&quot;</span><span class="tok-p">,</span>
      <span class="tok-nt">&quot;name&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;flowable-form-examples&quot;</span><span class="tok-p">,</span>
      <span class="tok-nt">&quot;deploymentTime&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;2010-10-13T14:54:26.750+02:00&quot;</span><span class="tok-p">,</span>
      <span class="tok-nt">&quot;category&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;examples&quot;</span><span class="tok-p">,</span>
      <span class="tok-nt">&quot;url&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;http://localhost:8081/form-api/form-repository/deployments/10&quot;</span><span class="tok-p">,</span>
      <span class="tok-nt">&quot;tenantId&quot;</span><span class="tok-p">:</span> <span class="tok-kc">null</span>
    <span class="tok-p">}</span>
  <span class="tok-p">],</span>
  <span class="tok-nt">&quot;total&quot;</span><span class="tok-p">:</span> <span class="tok-mi">1</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;start&quot;</span><span class="tok-p">:</span> <span class="tok-mi">0</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;sort&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;id&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;order&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;asc&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;size&quot;</span><span class="tok-p">:</span> <span class="tok-mi">1</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_获取单个部署">7.2.2. 获取单个部署</h4>
<div class="listingblock">
<div class="content">
<pre>GET form-repository/deployments/{deploymentId}</pre>
</div>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 12. 获取单个部署信息 - 请求参数</caption>
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">参数名称</th>
<th class="tableblock halign-left valign-top">是否必须</th>
<th class="tableblock halign-left valign-top">值类型</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">部署ID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">是</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">根据部署ID获取部署信息.</p></td>
</tr>
</tbody>
</table>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 13. 获取部署信息 - 响应编码</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">响应编码</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示该部署信息已经找到并且返回.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">404</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示请求的部署信息未找到.</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p><strong>成功响应体:</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4
5
6
7
8</div></td><td class="code"><span></span><span class="tok-p">{</span>
  <span class="tok-nt">&quot;id&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;10&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;name&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;flowable-form-examples&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;deploymentTime&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;2010-10-13T14:54:26.750+02:00&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;category&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;examples&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;url&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;http://localhost:8081/form-api/form-repository/deployments/10&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;tenantId&quot;</span> <span class="tok-p">:</span> <span class="tok-kc">null</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_创建部署信息">7.2.3. 创建部署信息</h4>
<div class="listingblock">
<div class="content">
<pre>POST form-repository/deployments</pre>
</div>
</div>
<div class="paragraph">
<p><strong>请求正文:</strong></p>
</div>
<div class="paragraph">
<p>请求正文应包含multipart / form-data类型的数据。 请求中应该只有一个文件，任何其他文件都将被忽略。 部署名称是传入的文件字段的名称。</p>
</div>
<div class="paragraph">
<p>可以在名称为tenantId的请求正文中传递附加参数（表单字段）。 此字段的值将用作完成此部署的租户的标识符。</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 14. 创建新的部署信息 - 响应编码</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">响应编码</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">201</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示已经部署成功.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">400</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示请求正文中不存在任何内容，或者部署不支持内容mime-type。 状态描述包含其他信息。</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p><strong>成功响应正文:</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4
5
6
7
8</div></td><td class="code"><span></span><span class="tok-p">{</span>
  <span class="tok-nt">&quot;id&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;10&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;name&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;simple.form&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;deploymentTime&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;2010-10-13T14:54:26.750+02:00&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;category&quot;</span><span class="tok-p">:</span> <span class="tok-kc">null</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;url&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;http://localhost:8081/form-api/form-repository/deployments/10&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;tenantId&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;myTenant&quot;</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_删除部署信息">7.2.4. 删除部署信息</h4>
<div class="listingblock">
<div class="content">
<pre>DELETE form-repository/deployments/{deploymentId}</pre>
</div>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 15. 删除一个部署信息 - 传输参数</caption>
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">参数</th>
<th class="tableblock halign-left valign-top">是否必须</th>
<th class="tableblock halign-left valign-top">值类型</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">部署ID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">是</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">要删除的部署的标识符。</p></td>
</tr>
</tbody>
</table>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 16. 删除某个部署 - 响应编码</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">响应编码</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">204</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示已找到部署并已删除。 响应体是空的。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">404</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示未找到请求的部署。</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect3">
<h4 id="_获取部署资源内容">7.2.5. 获取部署资源内容</h4>
<div class="listingblock">
<div class="content">
<pre>GET form-repository/deployments/{deploymentId}/resourcedata/{resourceId}</pre>
</div>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 17. 获取部署资源内容 - 请求参数</caption>
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">参数</th>
<th class="tableblock halign-left valign-top">是否必须</th>
<th class="tableblock halign-left valign-top">值类型</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">部署ID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">是</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">请求的资源所属的部署标识符。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">资源ID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">必须</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">获取数据的资源的标识符。 <strong>确保对resourceId进行URL编码，以防它包含正斜杠。 举个例子, 比如 <em>forms%2Fmy-form.form</em> 代替 <em>forms/my-form.form</em>.</strong></p></td>
</tr>
</tbody>
</table>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 18. 获取部署资源内容 - 响应编码</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">响应编码</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示已找到部署和资源，并且已返回资源数据。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">404</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示未找到请求的部署，或者部署中不存在具有给定ID的资源。 状态描述包含其他信息。</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p><strong>成功响应正文:</strong></p>
</div>
<div class="paragraph">
<p>响应正文将包含所请求资源的二进制资源内容。 响应内容类型将与资源&#8217;mimeType&#8217;属性中返回的类型相同。 此外，还设置了内容处置标题，允许浏览器下载文件而不是显示文件。</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_表单定义_3">7.3. 表单定义</h3>
<div class="sect3">
<h4 id="_表单定义列表">7.3.1. 表单定义列表</h4>
<div class="listingblock">
<div class="content">
<pre>GET form-repository/form-definitions</pre>
</div>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 19. 表单定义列表 - 请求参数</caption>
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">参数</th>
<th class="tableblock halign-left valign-top">是否必须</th>
<th class="tableblock halign-left valign-top">参数类型</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">version</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">整型</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回给定版本定义的表单.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">name</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回给定名称的定义的表单。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">根据name模糊匹配</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返会根据名称模糊匹配到的定义表单</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">key</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回具有给定键的表单定义。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">模糊匹配key</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回模糊匹配给定键的表单定义.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">resourceName</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回具有给定资源名称的表单定义</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">模糊匹配resourceName</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回具有模糊匹配资源名称的表单定义</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">category</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回给定类别的表单定义。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">模糊匹配category</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回模糊匹配给定类别的表单定义。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">不等于category</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回非给定类别的表单定义。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">deploymentId</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回作为具有给定标识符的部署的一部分的表单定义。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">latest</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">布尔</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回最新的表单定义版本。 只能与&#8217;key&#8217;和&#8217;keyLike&#8217;参数一起使用，使用任何其他参数将导致400响应。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">sort</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><em>name</em> (default), <em>id</em>, <em>key</em>, <em>category</em>, <em>deploymentId</em> 和 <em>version</em></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">要排序的属性，与“order”一起使用。</p></td>
</tr>
</tbody>
</table>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 20. 表单定义列表 - 响应编码</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">响应编码</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示请求成功，并返回表单定义</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">400</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示参数以错误的格式传递，或者“latest”与“key”和“keyLike”以外的其他参数一起使用。 状态消息包含其他信息。</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p><strong>成功响应正文:</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20</div></td><td class="code"><span></span><span class="tok-p">{</span>
  <span class="tok-nt">&quot;data&quot;</span><span class="tok-p">:</span> <span class="tok-p">[</span>
    <span class="tok-p">{</span>
      <span class="tok-nt">&quot;id&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;818e4703-f1d2-11e6-8549-acde48001122&quot;</span><span class="tok-p">,</span>
      <span class="tok-nt">&quot;url&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;http://localhost:8182/form-repository/form-definitions/simpleForm&quot;</span><span class="tok-p">,</span>
      <span class="tok-nt">&quot;version&quot;</span> <span class="tok-p">:</span> <span class="tok-mi">1</span><span class="tok-p">,</span>
      <span class="tok-nt">&quot;key&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;simpleForm&quot;</span><span class="tok-p">,</span>
      <span class="tok-nt">&quot;category&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;Examples&quot;</span><span class="tok-p">,</span>
      <span class="tok-nt">&quot;deploymentId&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;818e4703-f1d2-11e6-8549-acde48001121&quot;</span><span class="tok-p">,</span>
      <span class="tok-nt">&quot;parentDeploymentId&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;2&quot;</span><span class="tok-p">,</span>
      <span class="tok-nt">&quot;name&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;The Simple Form&quot;</span><span class="tok-p">,</span>
      <span class="tok-nt">&quot;description&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;This is a form for testing purposes&quot;</span><span class="tok-p">,</span>
    <span class="tok-p">}</span>
  <span class="tok-p">],</span>
  <span class="tok-nt">&quot;total&quot;</span><span class="tok-p">:</span> <span class="tok-mi">1</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;start&quot;</span><span class="tok-p">:</span> <span class="tok-mi">0</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;sort&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;name&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;order&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;asc&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;size&quot;</span><span class="tok-p">:</span> <span class="tok-mi">1</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_获取定义的表单">7.3.2. 获取定义的表单</h4>
<div class="listingblock">
<div class="content">
<pre>GET repository/form-definitions/{formDefinitionId}</pre>
</div>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 21. 获取表单 - 请求参数</caption>
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">参数</th>
<th class="tableblock halign-left valign-top">是否必须</th>
<th class="tableblock halign-left valign-top">值类型</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">formDefinitionId</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">是</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">要获取的流程定义的标识符。</p></td>
</tr>
</tbody>
</table>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 22. 获取定义的表单 - 响应编码</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Response code</th>
<th class="tableblock halign-left valign-top">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">响应编码</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">描述</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示已找到并返回表单定义。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">404</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示找不到请求的表单定义。</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p><strong>成功返回例子:</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11</div></td><td class="code"><span></span><span class="tok-p">{</span>
  <span class="tok-nt">&quot;id&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;818e4703-f1d2-11e6-8549-acde48001122&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;url&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;http://localhost:8182/form-repository/form-definitions/simpleForm&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;version&quot;</span> <span class="tok-p">:</span> <span class="tok-mi">1</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;key&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;simpleForm&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;category&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;Examples&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;deploymentId&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;818e4703-f1d2-11e6-8549-acde48001121&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;parentDeploymentId&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;2&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;name&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;The Simple Form&quot;</span><span class="tok-p">,</span>
  <span class="tok-nt">&quot;description&quot;</span> <span class="tok-p">:</span> <span class="tok-s2">&quot;This is a form for testing purposes&quot;</span><span class="tok-p">,</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_获取表单定义资源内容">7.3.3. 获取表单定义资源内容</h4>
<div class="listingblock">
<div class="content">
<pre>GET repository/form-definitions/{formDefinitionId}/resourcedata</pre>
</div>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 23. 获取表单定义资源内容 - 请求参数</caption>
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">参数名</th>
<th class="tableblock halign-left valign-top">是否必须</th>
<th class="tableblock halign-left valign-top">参数类型</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">formDefinitionId</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">是</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">用于获取资源数据的表单定义的标识符。</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p><strong>返回值:</strong></p>
</div>
<div class="paragraph">
<p>返回的编码和响应体与+GET form-repository/deployment/{deploymentId}/resourcedata/{resourceId}+ 一样.</p>
</div>
</div>
<div class="sect3">
<h4 id="_获取定义表单的表单模型">7.3.4. 获取定义表单的表单模型</h4>
<div class="listingblock">
<div class="content">
<pre>GET form-repository/form-definitions/{formDefinitionId}/model</pre>
</div>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 24. 获取定义表单的表单模型 - 请求参数</caption>
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">请求参数</th>
<th class="tableblock halign-left valign-top">是否必须</th>
<th class="tableblock halign-left valign-top">参数类型</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">formDefinitionId</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">是</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">获取模型的表单定义的标识符。</p></td>
</tr>
</tbody>
</table>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 25. 获取定义表单的表单模型 - 响应编码</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">响应编码</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示找到了表单定义并返回了模型.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">404</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示找不到请求的表单定义。</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p><strong>响应正文:</strong>
响应主体是+ org.flowable.form.model.FormModel +的JSON表示，并包含完整的表单定义模型。</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_表单实例">7.4. 表单实例</h3>
<div class="sect3">
<h4 id="_获取表单实例">7.4.1. 获取表单实例</h4>
<div class="listingblock">
<div class="content">
<pre>GET form/form-instances/{formInstanceId}</pre>
</div>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 26. 获取表单实例 - 请求参数</caption>
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">请求参数</th>
<th class="tableblock halign-left valign-top">是否必须</th>
<th class="tableblock halign-left valign-top">参数类型</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">formInstanceId</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">是</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">要获取的表单实例的标识符。</p></td>
</tr>
</tbody>
</table>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 27. 获取表单实例 - 响应编码</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">响应编码</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示找到并返回了表单实例.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">404</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示找不到请求的表单实例。</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p><strong>成功响应正文:</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12</div></td><td class="code"><span></span><span class="tok-p">{</span>
   <span class="tok-nt">&quot;id&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;48b9ac82-f1d3-11e6-8549-acde48001122&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;url&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;http://localhost:8182/form/form-instances/48b9ac82-f1d3-11e6-8549-acde48001122&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;formDefinitionId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;818e4703-f1d2-11e6-8549-acde48001122&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;taskId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;88&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;processInstanceId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;66&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;processDefinitionId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;oneTaskProcess:1:158&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;submittedDate&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;2013-04-17T10:17:43.902+0000&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;submittedBy&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;testUser&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;formValuesId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;818e4703-f1d2-11e6-8549-acde48001110&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;tenantId&quot;</span><span class="tok-p">:</span> <span class="tok-kc">null</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_存储表单实例">7.4.2. 存储表单实例</h4>
<div class="listingblock">
<div class="content">
<pre>POST form/form-instances</pre>
</div>
</div>
<div class="paragraph">
<p><strong>请求正文（以流程定义ID开头）:</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4
5
6
7
8
9</div></td><td class="code"><span></span><span class="tok-p">{</span>
   <span class="tok-nt">&quot;formDefinitionId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;818e4703-f1d2-11e6-8549-acde48001122&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;taskId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;88&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;processInstanceId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;66&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;processDefinitionId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;oneTaskProcess:1:158&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;variables&quot;</span><span class="tok-p">:</span> <span class="tok-p">{</span>
      <span class="tok-nt">&quot;input1&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;test&quot;</span>
   <span class="tok-p">}</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p><strong>请求正文（从表单定义键开始）：</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4
5
6
7
8
9</div></td><td class="code"><span></span><span class="tok-p">{</span>
   <span class="tok-nt">&quot;formDefinitionKey&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;simpleForm&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;taskId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;88&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;processInstanceId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;66&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;processDefinitionId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;oneTaskProcess:1:158&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;variables&quot;</span><span class="tok-p">:</span> <span class="tok-p">{</span>
      <span class="tok-nt">&quot;input1&quot;</span><span class="tok-p">:</span> <span class="tok-s2">&quot;test&quot;</span>
   <span class="tok-p">}</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>在请求正文中只能使用+ formDefinitionId <code>或</code> formDefinitionKey <code>中的一个。 参数+变量+和</code> tenantId <code>是可选的。 如果省略</code> tenantId +，将使用默认租户。 有关变量格式的更多信息可以在<a href="#restVariables">变量部分</a>中找到。</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 28. 存储表单实例 - 响应代码</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">响应吗</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">201</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示已创建表单实例。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">400</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示未找到表单定义（基于标识符或键），通过发送给定消息未存储表单实例，或者已传递无效变量。 状态描述包含有关错误的其他信息。</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p><strong>响应成功正文:</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12</div></td><td class="code"><span></span><span class="tok-p">{</span>
   <span class="tok-nt">&quot;id&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;48b9ac82-f1d3-11e6-8549-acde48001122&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;url&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;http://localhost:8182/form/form-instances/48b9ac82-f1d3-11e6-8549-acde48001122&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;formDefinitionId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;818e4703-f1d2-11e6-8549-acde48001122&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;taskId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;88&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;processInstanceId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;66&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;processDefinitionId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;oneTaskProcess:1:158&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;submittedDate&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;2013-04-17T10:17:43.902+0000&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;submittedBy&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;testUser&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;formValuesId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;818e4703-f1d2-11e6-8549-acde48001110&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;tenantId&quot;</span><span class="tok-p">:</span> <span class="tok-kc">null</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="restProcessInstancesGet">7.4.3. 表单实例列表</h4>
<div class="listingblock">
<div class="content">
<pre>GET form/form-instances</pre>
</div>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 29. 表单实例列表 - 请求参数</caption>
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">请求参数</th>
<th class="tableblock halign-left valign-top">是否必须</th>
<th class="tableblock halign-left valign-top">值类型</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">id</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回具有给定标识符的流程实例。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">表单定义ID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回具有给定表单定义标识符的表单实例。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">模糊匹配表单ID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回具有表单定义标识符（模糊匹配给定值）的表单实例。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">任务ID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回具有给定任务标识符的表单实例。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">模糊匹配任务ID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回具有任务标识符（如模糊匹配给定值）的表单实例。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">流程实例ID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回具有给定流程实例标识符的表单实例。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">模糊匹配表单实例ID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回具有与给定值(模糊匹配流程实例标识符)的表单实例。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">流程定义ID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回具有给定流程定义标识符的表单实例。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">模糊匹配流程定义ID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回具有与给定值（模糊匹配的流程定义标识符）的表单实例。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">由&#8230;&#8203;提交</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回由&#8230;&#8203;提交的给定提交的表单实例。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">模糊匹配由&#8230;&#8203;提交</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">只返回模糊匹配给定值的提交的表单实例。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">租户ID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回具有给定租户ID的流程实例。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">模糊匹配租户ID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">仅返回具有类似给定值的(模糊匹配租户ID)的流程实例。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">没有租户ID</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">布尔</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">如果 true，则仅返回没有设置租户ID的流程实例。 如果是false，则忽略 租户ID 参数。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">排序</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">否</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">字符串</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">排序字段，应该是 提交日期 （默认）或 租户ID。</p>
<p class="tableblock">一般<a href="#restPagingAndSort">分页和排序 查询参数</a>可以用在本链接</p></td>
</tr>
</tbody>
</table>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 30. 表单实例列表 - 响应编码</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">响应编码</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示请求成功，并返回表单实例</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">400</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示参数以错误的格式传递。 状态消息包含其他信息。</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p><strong>成功响应正文:</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21</div></td><td class="code"><span></span><span class="tok-p">{</span>
   <span class="tok-nt">&quot;data&quot;</span><span class="tok-p">:[</span>
      <span class="tok-p">{</span>
	   <span class="tok-nt">&quot;id&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;48b9ac82-f1d3-11e6-8549-acde48001122&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;url&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;http://localhost:8182/form/form-instances/48b9ac82-f1d3-11e6-8549-acde48001122&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;formDefinitionId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;818e4703-f1d2-11e6-8549-acde48001122&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;taskId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;88&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;processInstanceId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;66&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;processDefinitionId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;oneTaskProcess:1:158&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;submittedDate&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;2013-04-17T10:17:43.902+0000&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;submittedBy&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;testUser&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;formValuesId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;818e4703-f1d2-11e6-8549-acde48001110&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;tenantId&quot;</span><span class="tok-p">:</span> <span class="tok-kc">null</span>
	  <span class="tok-p">}</span>
   <span class="tok-p">],</span>
   <span class="tok-nt">&quot;total&quot;</span><span class="tok-p">:</span><span class="tok-mi">1</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;start&quot;</span><span class="tok-p">:</span><span class="tok-mi">0</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;sort&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;submittedDate&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;order&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;asc&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;size&quot;</span><span class="tok-p">:</span><span class="tok-mi">1</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_查询表单实例">7.4.4. 查询表单实例</h4>
<div class="listingblock">
<div class="content">
<pre>POST query/form-instances</pre>
</div>
</div>
<div class="paragraph">
<p><strong>请求正文:</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3</div></td><td class="code"><span></span><span class="tok-p">{</span>
  <span class="tok-nt">&quot;formDefinitionId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;818e4703-f1d2-11e6-8549-acde48001122&quot;</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
<div class="paragraph">
<p>请求正文可以包含可以在查询<a href="#restFormInstancesGet">流程实例列表</a>中使用的所有可能的过滤器</p>
</div>
<div class="paragraph">
<p>普通 <a href="#restPagingAndSort">分页和排序，查询参数</a> 可用于此URL。</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 31. 查询表单实例 - 响应编码</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">响应编码</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示请求成功，并返回表单实例</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">400</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示参数以错误的格式传递。 状态消息包含其他信息</p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p><strong>成功响正文:</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21</div></td><td class="code"><span></span><span class="tok-p">{</span>
   <span class="tok-nt">&quot;data&quot;</span><span class="tok-p">:[</span>
      <span class="tok-p">{</span>
	   <span class="tok-nt">&quot;id&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;48b9ac82-f1d3-11e6-8549-acde48001122&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;url&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;http://localhost:8182/form/form-instances/48b9ac82-f1d3-11e6-8549-acde48001122&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;formDefinitionId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;818e4703-f1d2-11e6-8549-acde48001122&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;taskId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;88&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;processInstanceId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;66&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;processDefinitionId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;oneTaskProcess:1:158&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;submittedDate&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;2013-04-17T10:17:43.902+0000&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;submittedBy&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;testUser&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;formValuesId&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;818e4703-f1d2-11e6-8549-acde48001110&quot;</span><span class="tok-p">,</span>
	   <span class="tok-nt">&quot;tenantId&quot;</span><span class="tok-p">:</span> <span class="tok-kc">null</span>
	  <span class="tok-p">}</span>
   <span class="tok-p">],</span>
   <span class="tok-nt">&quot;total&quot;</span><span class="tok-p">:</span><span class="tok-mi">1</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;start&quot;</span><span class="tok-p">:</span><span class="tok-mi">0</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;sort&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;submittedDate&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;order&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;asc&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;size&quot;</span><span class="tok-p">:</span><span class="tok-mi">1</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_表单引擎">7.5. 表单引擎</h3>
<div class="sect3">
<h4 id="_获取表单引擎信息">7.5.1. 获取表单引擎信息</h4>
<div class="listingblock">
<div class="content">
<pre>GET form-management/engine</pre>
</div>
</div>
<div class="paragraph">
<p>返回此REST服务中使用的引擎的只读视图。</p>
</div>
<div class="paragraph">
<p><strong>成功响应正文:</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="json"><table class="pyhltable"><tr><td class="linenos"><div class="linenodiv">1
2
3
4
5
6</div></td><td class="code"><span></span><span class="tok-p">{</span>
   <span class="tok-nt">&quot;name&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;default&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;version&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;6.4.2-SNAPSHOT&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;resourceUrl&quot;</span><span class="tok-p">:</span><span class="tok-s2">&quot;file://flowable/flowable.form.cfg.xml&quot;</span><span class="tok-p">,</span>
   <span class="tok-nt">&quot;exception&quot;</span><span class="tok-p">:</span><span class="tok-kc">null</span>
<span class="tok-p">}</span>
</td></tr></table></code></pre>
</div>
</div>
<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 32. 获取引擎信息 - 响应编码</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">响应编码</th>
<th class="tableblock halign-left valign-top">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">200</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">表示返回表单引擎信息。</p></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</body>
</html>